This is my code:
select assignedstfid, staffname, staffsymbol, SUM(case where bookingstarttime > '2021-03-31' then TIMESTAMPDIFF (minute, bookingstarttime, bookingendtime) else 0 end) as lengthofworking from crm.bookingtable, crm.staffinfo where staffinfo.staffid = bookingtable.assignedstfid GROUP BY assignedstfid ;
and there is a syntax error about 'select' saying that 'select is not valid in this position for this server version, expecting " ( " with' ...
How could I fix this?
the query is based on this question(SQL sum with condition)