mysql - How to I grab the alternate object than the one I am searching with this inner join -



mysql - How to I grab the alternate object than the one I am searching with this inner join -

i have 2 tables, users table , messages table.

users: id (int) username (varchar) messages: id(int) send_id(int) receive_id(int)

i using query gets me of messages specific user sent:

select users.id, users.username users inner bring together messages on messages.send_id = users.id , users.id = someuserid

how go grabbing receiving user's id , username instead of sending users information?

select rec.id, rec.username users send bring together messages on (messages.send_id = send.id) bring together users rec on (messages.receive_id = rec.id) send.id = someuserid

mysql sql join

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -