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

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



Reply via email to