Mysql – How to use GROUP BY on columns with SUM and CASE WHEN
I have a query like this Select a.ordernum, a.region, c.area, a.branchname, a.stagename, sum(case when b.entrydatetime is not null THEN 1 ELSE 0 END) as 'Total Count', sum(case when DATEDIFF(day, b.entrydatetime, GETDATE()) <=1 THEN 1 ELSE 0 END) as 'WITHIN 1…