NYCPHP Meetup

NYPHP.org

[nycphp-talk] simple mysql query help

Michael Southwell southwell at dneba.com
Tue Aug 6 11:33:12 EDT 2002


how about this (haven't tested it)?  select aaa.*,bbb.* from aaa,bbb where 
aaa.a!=bbb.a and bbb.a!=aaa.a;

At 11:16 AM 8/6/2002, you wrote:

>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.

Michael G. Southwell =================================
DNEBA Enterprises
81 South Road
Bloomingdale, NJ 07403-1419
973/492-7873 (voice and fax)
southwell at dneba.com
http://www.dneba.com
======================================================





More information about the talk mailing list