| 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_howarth | 20 Jul |
| • Re: Bad query structure... | SGreen | 20 Jul |
| • Re: Bad query structure... | Petr Vileta | 20 Jul |
| • Re: Bad query structure... | ian_t_howarth | 22 Jul |
| • Re: Bad query structure... | Petr Vileta | 22 Jul |
