I have this output from this query:
select Date,Status, count(distinct persons)from TableA where Date='2014-11-04' group by Status;
+------------+------------------------+-------------------------------+
| Date | Status | count(distinct persons) |
+------------+------------------------+-------------------------------+
| 2014-11-04 | 0 | 45 |
| 2014-11-04 | 1 | 93 |
+------------+------------------------+-------------------------------+
What I wanted to get is that:
+------------+------------------------+-------------------------------+
| Date | 0 | 1 |
+------------+------------------------+-------------------------------+
| 2014-11-04 | 45 | 93 |
+------------+------------------------+-------------------------------+
You can put a condition inside your
COUNT
function usingCASE
: