Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
Ofcourse I could simply add 2 queries, but this page is already very heavy on the queries, around 20 or so, so I need to keep it to a minimum if possible :)
edit: mysql naturally ;)
For example if you have the following
a table called submission with fields
all id's found in the table user
and a table called user
Then you can use the following select, the bold items is where I'm aliasing the tables in the SQL statement.
-- add any other fields here
where submission.submitterid = submitter.id
and submission.lasteditid = editor.id
and submission.approverid = approver.id
-- add any other conditions to limit the selection
There is also another way to structure the above which is using the "inner/left outer join" type syntax, but that depends on whether it is suported by the version of SQL you are using.
Also you wil have to consider if one of the three id's in the submission table can be null.