0

I need count the cc column. in the way that the result will this with only 2 rows. first row. the quantity of people that have premio_id = 0 and the second row, the quantity of people that have premio_id different to 0. thanks all.

simulation of result.

| quantity_people | premio type     |
|    3000         |     0           |
|    25231        | different to  0 |

Table:

table data

Blank
  • 12,308
  • 1
  • 14
  • 32
zebaz
  • 13
  • 3

1 Answers1

0

Try this:

select sum(cc) as quantity_people,
(case premio_id when 0 then '0' else 'different to 0' end) as premio_type
from your_table_name
group by (case premio_id when 0 then '0' else 'different to 0' end);
roshan
  • 323
  • 8
  • 22