Hey I have trouble joining tables in a way that I can obtain profile info from an event. Allow me to clarify. My website has an event table: user1(int), user2(int), event_type(int). Events join two users together.
Now, from this standpoint the data I have is the user ID. The user ID can either be at user1 or user2. Though I want to join the user table to obtain information for both users.
here is my statement:
SELECT * FROM users, events WHERE (events.user1 = $id or events.user2 = $id) AND events.user1 = users.profile AND events.user2 = users.profile.
I know I'm not doing this right but I don't understand how else I can obtain the data of both users from the event table... I think I'm leaving out a logic or function. How can this be done?
Any help in the right direction is greatly appreciated.