I want to learn an easier way to do a query where I command to count the results of some code.
This is the sentence that I carry out to obtain the counter of all the individuals that have sex = 'M':
select count(codigo) as contM, from cliente where sexo='M' and agencia='01'
but I have other sex codes (F and L) that I would like to consult in the same sentence; I perform several queries that also give me the same result, but I want to know if there is any way to query the same column 3 times but each conditional related to gender is different.
You can display it in 3 rows:
the result would look like this:
or in 3 columns:
the result would look like this:
In both cases aggregation functions are used and for the first case
group by
.I hope you find it useful, greetings.