List:MySQL on Win32« Previous MessageNext Message »
From:Petr Vileta Date:July 22 2004 2:58pm
Subject:Re: Bad query structure...
View as plain text  
> I tried the suggestion:
> >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
>
> but I get the message "Unknown column `counter` in `where clause`
Sorry, I wrote this by heart. This working:

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

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