RE: [PHP-DB] Order by multiple tables

From: Date: Mon, 07 Aug 2000 22:40:45 +0000
Subject: RE: [PHP-DB] Order by multiple tables
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-1840@lists.php.net to get a copy of this message
another example mods_list is a table that contains lots of info about *mods* mods_login is a table that contains login info like user name and password SELECT mods_list.id AS id mods_login.name AS author mods_login.email AS author_email FROM mods_list INNER JOIN mods_login ON mods_list.id_login = mods_login.id WHERE mods_login.active = 1 and mods_list.active = 1 ORDER BY mods_list.datestamp DESC" for a great SQL sample page try http://w3.one.net/~jhoffman/sqltut.htm hope that helps Tigger-oN > -----Original Message----- > From: Sam Masiello [mailto:smasiello@chekinc.com] > Sent: Monday, 7 August 2000 11:47 PM > To: Simon Biela; php-db@lists.php.net > Subject: RE: [PHP-DB] Order by multiple tables > > > > You need to join the tables based on a commonality between them. > Otherwise, > you will get a cross-product between the two tables. Like this: > > SELECT <whatever> > FROM table1, table2 > WHERE table1.value=table2.value > > HTH > > Sam Masiello > System Analyst > Chek.Com > (716) 853-1362 x289 > smasiello@chekinc.com > > -----Original Message----- > From: Simon Biela [mailto:s.biela@netdienste.de] > Sent: Monday, August 07, 2000 9:50 AM > To: Sam Masiello; Simon Biela; php-db@lists.php.net > Subject: AW: [PHP-DB] Order by multiple tables > > Hi again! > > I don't know what I am doing wrong, but I get the following error: > > In table1, there are 10 entries. In table2 I can find 7 entries. > As soon as > I say: > SELECT * FROM table1, table2 > > MySQL returns 70 results. Is that right? > > mfG > Simon >

« previous php.db (#1840) next »