So I'm using this code to get the last entry for each day from a database.
SELECT a.id, a.userid, a.jurisdiction, a.country, a.date
FROM dk_location_records AS a,
(SELECT userid, DATE(date) AS just_date, MAX(date) AS date
FROM dk_location_records
GROUP BY 1, 2 --userid, DATE(date)
) AS b
WHERE a.userid = b.userid
AND a.date = b.date;
My question is, how can I incorporate something like: CONVERT_TZ( date, '+00:00', '+01:00' )
to get the last entry per day for a different timezone. I've so far managed to use the CONVERT_TZ
to simply display the converted dates. However, can you use MAX()
and CONVERT_TZ()
together?