NYCPHP Meetup

NYPHP.org

simple mysql query help

cesar can at andrew.cmu.edu
Tue Aug 6 11:16:33 EDT 2002


i have two tables aaa and bbb
aaa has {1 , 2}
bbb has {1 , 3 }

i want select those values in aaa that don't appear in bbb, and also
another query that will delete those values in aaa which don't appear in
bbb. if someone can please help me, i'm just a little stuck. i know i
figured it out before, but right now i have no clue.

 A)
mysql> select * from aaa;
+------+
| a    |
+------+
|    1 |
|    2 |
+------+

mysql> select * from bbb;
+------+
| a    |
+------+
|    1 |
|    3 |
+------+

B)i understand why this does what it does, but how do i correct it?
mysql> select aaa.*, bbb.* from aaa, bbb where aaa.a != bbb.a;
+------+------+
| a    | a    |
+------+------+
|    2 |    1 |
|    1 |    3 |
|    2 |    3 |
+------+------+

thnka you in advance.




More information about the talk mailing list