jeudi 8 octobre 2015

SQL count each occurrence of case sqlite

I'm trying to return 2 columns: Day of the week and number of occurrences in that day. How would I return the number of occurrences for each day?

SELECT case CAST(strftime('%w', HireDate) AS INTEGER)
   WHEN 0 then 'Sunday'
   WHEN 1 then 'Monday'
   WHEN 2 then 'Tuesday'
   WHEN 3 then 'Wednesday'
   WHEN 4 then 'Thursday'
   WHEN 5 then 'Friday'
   ELSE 'Saturday' END AS 'Day of week',  AS 'Hired'
   FROM Employee;

Aucun commentaire:

Enregistrer un commentaire