Invalid query: 0 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '), 1 as 'grp', UNIX_TIMESTAMP(MAX(dat)) as 'stamp' FROM cbrf WHERE dat<=CURDATE(' at line 1