SELECT SUBSTRING(m.content,1,20) as content,
m.viewed, m.sent_date,
u.username
FROM message m
INNER JOIN user u
ON u.userid = m.message_from
WHERE m.message_to = :userid
My problem with this query is that it's selecting multiple rows from the same username. I just want it to select one row per username.
I believe I use DISTINCT for this?
I couldn't get it working, can someone assist me!
Thanks.