Re: while inside a while or join or...

From: Date: Mon, 17 May 2004 00:43:06 +0000
Subject: Re: while inside a while or join or...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186371@lists.php.net to get a copy of this message
T. H. Grejc wrote:
Hallo, I know of a few ways of doing this but I am not sure that any is right. I want to consult with you what is the best way of doing this: Table 1: +----+-----+ | *a* | *b* | +----+-----+
|  2   |  1    |
+----+-----+
|  2   |  2    |
+----+-----+ Table 2: +----+-----+ | *b* | *d* | +----+-----+ | 1 | asd | +----+-----+ | 2 | fgh | +----+-----+ I would like to select all 'b' from Table_1 WHERE a = '2' and then to select all 'd' from table_2 with 'b' from previous result. Table 2 is the Table with UserNames (d) and Table 1 is the table with 'marked' UserID's (b).
What's this go to do with PHP? This should be on php-db at least... SELECT t1.b, t2.d FROM table1 t1, table2, t2 WHERE t1.a = 2 AND t1.b = t2.b -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#186371) next »