join question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a table referencing the same field from the other table


Now I want to display creation_user and modification_user at the same time
with one query.
Is it possible?

to join the two table can be done like this
select * from topic t join user u on t.creation_user_id = and
t.modification_user_id =

but I want to display the username for both of cration_user and
name creation_user modification_user
Topic1 user1 user2

Re: join question

sdkjfldsjfl schreef:
Quoted text here. Click to load it

Wrong newsgroup. ;-)

PHP != Database
PHP !== Database

Erwin Moller

"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare

Re: join question

sdkjfldsjfl wrote:
Quoted text here. Click to load it
Try a left join and use of the 'as' command.

So your table is joined 'as' a different name, which allows you to
select  the correct names from the different columns that result.

You can left join as many times as you want. With the same table.

Re: join question

The Natural Philosopher wrote:
Quoted text here. Click to load it

That was a fine way of providing an answer while *not* giving the
answer away. <tips hat>



Site Timeline