I'm having some problems with a SQL query. The thing is that I need to join a table "users" with two tables...which means that it won't be unique because user_name will occur more than once....how can I avoid this problem. I would like to retriev the data using only one query if it's possible. I have put the incorrect syntax in brackets...but left it in to show what I need to do.
SELECT u1.user_name, s.message, r.message
FROM spotlight AS s
INNER JOIN reply AS r ON s.id = r.s_id
INNER JOIN users AS u1 ON u1.id = r.user_id
INNER JOIN users AS u2 ON s.user_id = u2.id
WHERE s.id=1