I have some problem using this query, it appears that i cannot use alias as reference on group by query
SELECT v.V_VEHICLEID, v.V_LICENSENO, ROUND((MAX(IF(DA
you did not specify the alias WP. take a look, it must be like this: ...
JOIN WAYPOINTS wp on wp.WP_VEHICLEID = v.V_VEHICLEID