1
I would like to make a select in the same table that counts 4 different values, all with clauses, I’m trying this way but I’m not getting it, I want each Count to be done in a STATUS where I specify there, but it’s not returning me anything, where I’m going wrong?
SELECT count(id) as new AND status IN ('pgto_confirmado', 'pending'), count(id) as fup AND status IN ('processing'), count(id) as ce AND status IN('confirmar_entrega'), count(id) as complete AND status IN ('complete', 'repassado')
FROM sgn_tbd_pedido
WHERE data_entregar LIKE '%2018-03-08%'
GROUP BY cidade;
I would like you to return for example:
Cidade NEW FUP CE COMPLETE Campinas 19 11 5 100
In this total Count(*), it will return me all the sums? in a single number?
– Gustavo Souza
In the case of Count(*) returns all records of the table the sum returns all that you epsecified through your predicate
– Marcos Brinner