Hello. I have two tables: users and actions
One action contains two users so there are two primary keys user1id and user2id (which are foreign keys from the users table)
How would I go about joining these tables in a query where I want to select each of the users' last names? The last names are a field in the users table.
Example query:
Code:
SELECT users.lastname
FROM (actions LEFT JOIN users ON actions.user1id = users.userid)
LEFT JOIN users ON actions.user2id = users.userid
This does not work however.
All help is greatly appreciated
I write sql directly, no wizard stuff.