List:MySQL on Win32« Previous MessageNext Message »
From:Petr Vileta Date:July 20 2004 2:21pm
Subject:Re: Bad query structure...
View as plain text  
> I am trying to identify items with no records in a sub-set, such as a
customer
> with no purchases.  I have tried several different queries but none
provide
> the correct result set, eq:
>
> SELECT Count(P.Ref)=0, C.Ref, C.Surname, C.Forename FROM Clients C JOIN
> Purchases P ON C.Ref=P.Ref

SELECT Count(P.Ref) as Counter, C.Ref, C.Surname, C.Forename FROM Clients C
JOIN
Purchases P ON C.Ref=P.Ref WHERE Counter=0 GROUP BY C.Ref


Petr Vileta, Czech republic

Thread
Bad query structure...ian_t_howarth20 Jul
  • Re: Bad query structure...SGreen20 Jul
  • Re: Bad query structure...Petr Vileta20 Jul
    • Re: Bad query structure...ian_t_howarth22 Jul
      • Re: Bad query structure...Petr Vileta22 Jul