I made a query select
like this:
SELECT
data,
sexo,
idade,
count(*) qtd
FROM marcacao
group by data, sexo, idade
And I get a table similar to the table below:
DATA | SEXO | IDADE | QTD
01/07/2017 | F | 30 | 3
01/07/2017 | F | 33 | 2
02/07/2017 | F | 45 | 4
03/07/2017 | F | 51 | 5
I want to make a select
based on the select
previous, being that I need to filter by dates and by age, it would be something + - like this:
SELECT (Select_anterior)
where data >= dataini and data <= dataini
And the result should be by age, eg:
FAIXA ETARIA | SEXO | QTD
0 - 10 | F | 30
11 - 20 | F | 22
21 - 30 | F | 13
31 - 40 | F | 28
I do not know if it's possible to do something like this. I hope you have understood my question, but I can change the question if necessary.