I have such query in my program:
Select customer.Id, customer.FirstName, customer.LastName, SUM(PeriodHours) as SUMPeriodHours, PeriodDay from
((SELECT CustomerId,
(UNIX_TIMESTAMP(taskinterval.EndDateUtc) - UNIX_TIMESTAMP(taskinterval.StartDateUtc)) / 3600 as PeriodHours, date(taskinterval.StartDateUtc) as PeriodDay
FROM taskinterval
where StartDateUtc > @STARTDATE and StartDateUtc<@ENDDATE) as tmptbl) Inner Join customer on customer.Id = tmptbl.CustomerId
group by PeriodDay, customer.Id, customer.FirstName, customer.LastName
It does not work neither in code of my program, nor in SqlWorkbench when I substitute ‘@ENDDATE’ and ‘@STARTDATE’
It works fine on MariaDB 10.3.32 but on MySQL 8.0.35 it does not work, such error is shown:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) Inner Join customer on customer.Id = tmptbl.CustomerId group’
This error seems vague for me. I have looked at this article: https://mariadb.com/kb/en/incompatibilities-and-feature-differences-between-mariadb-10-4-and-mysql-8-/ but did not find anything that may help me with that question. How do I fix this query to make it compatible with MySQL ?