I have the following query:
WITH cte1 AS ( SELECT g.id, g.IMEI, Timestamp, GPS_Latitude, GPS_Longitude, CASE W