views:

18

answers:

1

lets say my table like:

Date                   Status
2010-01-02            
2010-01-03             accept
2010-01-03             accept
2010-01-03             reject
2010-01-03
2010-01-04             reject

i want if value null, it means accept. Beside that i want show the result like:

Date         Accept            Reject      
2010-01-02    1                 0
2010-01-03    3                 1
2010-01-04    0                 1

it means, calculate the amount of either accept or reject which contained in the status column. How do i do that?

A: 
SELECT DATE AS DATE, SUM( IF( 
STATUS =  'accept', 1, 0 ) ) AS Accept, SUM( IF( 
STATUS =  'reject', 1, 0 ) ) AS Reject
FROM pivot
GROUP BY DATE

updated** and working

JapanPro