Reputation: 31
I tried this code:
SELECT SUM(bookingstatus)
FROM beo_eventorder AS TotalBookingStatu
WHERE bookingstatus = 'Tentative';
But this returns 0. There are 6 matches in the table. Why does this not return 6?
Screenshot of column:
Upvotes: 0
Views: 45
Reputation: 195
SUM
adds all the elements on the column, in your case, it added all the strings to be 0. You should use a COUNT
function instead.
Upvotes: 0
Reputation: 1319
You should use count
instead of sum
:
SELECT count(bookingstatus) FROM beo_eventorder AS TotalBookingStatus WHERE bookingstatus = 'Tentative';
Upvotes: 1