Union Clause

From: Mtek <mtek_at_mtekusa.com>
Date: Mon, 5 May 2008 06:17:39 -0700 (PDT)
Message-ID: <4efe88ca-c394-4c58-9f5c-95fc833b973a@24g2000hsh.googlegroups.com>

Hi,

This is my query:

SELECT SUM(zcom) + SUM(ze) + SUM(zp)
FROM
(SELECT count(DISTINCT(email)) FROM customers_lookup) zcom
    UNION
(SELECT count(DISTINCT(email)) FROM customers_lookup) ze
    UNION
(SELECT count(DISTINCT(email)) zp FROM customers_lookup) zp);

Basically I want to get a count from the three tables where the email address appears in ALL THREE tables. If an email does not exist in all three tables, then I do not want it counted.......

I think I'm barking up the wrong tree with the query above......

John. Received on Mon May 05 2008 - 08:17:39 CDT

Original text of this message