I am currently working with MySQL creating a view that would return the following:
NAME | EMAIL | LAST_SEEN
abby | a@l.d | 2015-10-31 14:36:26
abby | a@l.d | 2015-11-28 13:30:37
I then apply the GROUP BY name
to the select query
and it returns the following
NAME | EMAIL | LAST_SEEN
abby | a@l.d | 2015-10-31 14:36:26
I want to know how can I fix this query so that it returns the following:
NAME | EMAIL | LAST_SEEN
abby | a@l.d | 2015-11-28 13:30:37
the actual code is as follows:
CREATE VIEW v_user_last_seen
AS
SELECT concat_ws(' ', u.first_name, u.middle_name, u.last_name) AS user_name
,c.email
,l.in_when AS last_seen
FROM user AS u
INNER JOIN check_here_first AS c ON c.email = u.email
INNER JOIN log AS l ON l.u_id = c.username
GROUP BY user_name
ORDER BY user_name ASC