I cannot seem to search when I add WHERE statement below. But it works without it….
Is there something wrong?
Below is my code: Thank you.
SELECT DISTINCT (
`name`
), users.id, `email`, `state_id`,
MAX(`total_time_driven_at_this_trip`) AS trip
FROM `users`
LEFT JOIN trip_vics ON users.id = trip_vics.user_id
GROUP BY `user_id`
WHERE name LIKE '%dan%'
You need to place your
whereright beforegroup by