mySQL 'multiple' SELECT

From: Date: Wed, 06 Dec 2000 03:13:33 +0000
Subject: mySQL 'multiple' SELECT
Groups: php.general 
Request: Send a blank email to php-general+get-28817@lists.php.net to get a copy of this message
Hello, I have a very simple question: I've got 4 tables. (table1, table2, table3, table4) Each of them is having a field called 'user' containing the 'id' of another fifth table called 'users'. The reason for it is to being able browsing any of the table(1-4) and search for the user with something like: SELECT user FROM $table WHERE id='$id'; { SELECT * FROM users where id=$result_of_above; } Now, is there any simpler way to do it? I would like it to be in one single statement. And, how can I do vice versa? SELECT id FROM users WHERE field='value'; and then find which of the 4 tables contains field 'user' equal to the result of above. Thanks in advance. Maxim Maletsky. Maxim Maletsky - maxim@j-door.com <mailto:maxim@j-door.com> Webmaster, J-Door.com / J@pan Inc. LINC Media, Inc. TEL: 03-3499-2175 x 1271 FAX: 03-3499-3109 http://www.j-door.com <http://www.j-door.com/> http://www.japaninc.net <http://www.japaninc.net/> http://www.lincmedia.co.jp <http://www.lincmedia.co.jp/>

« previous php.general (#28817) next »