Re: RE: regarding multiple joins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 05:26 PM 11/22/02 -0800, Jonathan Narong wrote:
sorry for my confusing email... i'll try to clarify what i was asking:

i have two tables (i shortened them to only show the parts relating to what
i'm trying to do now) ...

CREATE TABLE articles (
  id smallint(4) unsigned zerofill NOT NULL auto_increment,
  title varchar(40) NOT NULL default '',
  public char(1) NOT NULL default 'y',
  author smallint(6) default NULL,
  editor smallint(6) default NULL,
  photog1 smallint(6) default NULL,
  photog2 smallint(6) default NULL,

CREATE TABLE people (
  id tinyint(3) unsigned NOT NULL auto_increment,
  name varchar(30) NOT NULL default '',
Try this...

SELECT title, a.name AS AuthorName, b.name AS EditorName,
       c.name AS Photog1Name, d.name AS Photog2Name
FROM articles, people a, people b, people c people d
WHERE author = a.id AND editor = b.id
  AND photog1 = c.id AND photog2 = d.id
  AND what ever else you want in the where clause;


Rick


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux