What is the best way to modify my query so that I also get the full name of the receiver in addition to the sender?
Thanks!
select u.uID
, concat (u.firstname, ’ ', u.lastName) as sender
, m.senderID
, m.receiverID
, m.senderMessage
from users u
inner join messages m
on u.uID = m.senderID
where u.uID = m.receiverID or u.uID = m.senderID;
Yes. You didn’t try what Rudy said
The part in red is what you wrote, and is wrong. You must change that to the code he posted at the end. And there is no x.receiverID in that code.
Checking further it was because I had x.receiverID earlier in the select statement before the FROM. I took that out and it works. Thanks to both of you!