List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 6 1999 3:55pm
Subject:Re: Help me to form a SELECT please
View as plain text  
At 16:51, 19990806, Andrey Muratov wrote:
>SELECT DISTINCT M1.item FROM Medic M1, Medic M2 WHERE (M1.item=M2.item)
>and (M1.dealer=11) and (M2.dealer<>11);

Try this:

    SELECT      M2.item, COUNT(*) AS Cnt
    FROM        Medic M1, Medic M2
    WHERE       M1.dealer = 11
    AND         M1.item = M2.item
    GROUP BY    M2.item
    HAVING      Cnt = 1

It's early in my morning, and I could be wrong, but I think that's
what you want.

Tim
Thread
Help me to form a SELECT pleaseAndrey Muratov6 Aug
Re: Help me to form a SELECT pleaseAndrey Muratov6 Aug
  • Re: Help me to form a SELECT pleaseThimble Smith6 Aug
  • SQL Cookbook for MySQL? (was: Help me to form a SELECT please)Martin Ramsch9 Aug