I have the following select statement for a MySQL database. This displays the counts for slabs and driedins for Users that have entered data in the table FieldSuperDataEntry.
I want to also show Users that have NOT entered data in the FieldSuperDataEntry table in the date range in the Where clause, they should have 0 for slabs and driedins. Any idea how I can change my select statement?
Thank you in advance.
SELECT Concat(Users.firstname, ' ', Users.lastname) As Super,
SUM(CASE WHEN Type=1 THEN 1 ELSE 0 END) as Slabs,
SUM(CASE WHEN Type=2 THEN 1 ELSE 0 END) as DriedIn
FROM Users LEFT OUTER JOIN FieldSuperDataEntry ON Users.userid = FieldSuperDataEntry.UserID LEFT OUTER JOIN JobType ON FieldSuperDataEntry.Type = JobType.jobtypeid WHERE (Date(CreateDate) >= '2013-11-01'AND Date(CreateDate) <= '2013-11-30')
GROUP BY Super
ORDER BY Super