Reply to Re: SQL question [2]

Your name:

Reply:


Posted by Bill Karwin on 02/27/06 01:05

"lallous" <lallous@lgwm.org> wrote in message
news:46eo94Fap8opU1@individual.net...
> How can I write a query, passing it a 'rowid=1' and it should return
> something like:
> rowid=>1, name1=>'user1', name2=>'user1', name3=>'user2'
>
> So, when I pass that query a given ROWID it would return (not the ids of
> the users, but) the names of the users from the NAMES table.

Yes, this is fine; it requires three joins to the NAMES table:

SELECT T.rowid, N1.name, N2.name, N3.name
FROM TABLE2 AS T
INNER JOIN NAMES AS N1 ON T.nameid1 = N1.id
INNER JOIN NAMES AS N2 ON T.nameid2 = N2.id
INNER JOIN NAMES AS N3 ON T.nameid3 = N3.id

Regards,
Bill K.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация