Even if sub-selects were available in MySQL (which they're not), that query
would still not work as it will only select the values that are unique to
tableA.

What you would be looking at is something like:

SELECT email
FROM tableA
UNION
SELECT email
FROM tableB

But unfortunately, UNION is not available yet either.  The next best thing
that I can think of is to create a temporary table with the email column
having a unique index and first add the contents of tableA and then tableB.
Finally, you can then retrieve all values from the temporary table which
contains all values from both tableA and tableB, without the duplicates.

----- Original Message -----
From: "{ randy }" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 12:28
Subject: Syntax question for a beginner..


> Alright, I am about to pull my hair out.
>
> I have 2 tables. Each have a column 'email' that are unique. Some of the
> records in both tables are duplicates and I want to combine the two tables
> into one with out bringing in the duplicates. So...
>
> I have this statement:
> Mysql> SELECT email FROM tableA WHERE NOT (email IN(SELECT email FROM
> tableB));
>
> Now, this gives me an error at the second SELECT. I have been trying
> different ways, but no go. I got the general syntax from a friend, but I
> could not get it to work. Is my syntax just wrong?
>
> mysql  Ver 11.13 Distrib 3.23.36, for -freebsd4.3 (i386)
>
> Any help would be appreciated,
> - randy
>
>
> P.S.
> Fist time poster, first time lister :)
> =============================
> r a n d y / sesser at mac.com
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to