>Hi all,
>
>I am trying the following SQL command
>
>SELECT Id, Forename, Compname, SUM(OrdTotal) TotOrd ;
> FROM clients LEFT JOIN Prsndetl ON Clients.Id = PrsnDetl.ClientId;
> LEFT JOIN Orders ON Clients.Id = Orders.ClientId;
> GROUP BY Clients.Id, Clients.Compname, PrsnDetl.Forename;
> WHERE '01' $ LOWER(Clients.CompName) ;
> OR 'hr' $ LOWER(PrsnDetl.Forename) ;
> OR TotOrd = 300
>
>The system gives me error that "variable TotOrd is not found". Any ideas, how I can use the column in my where clause.
>
>Many thanks in advance,
>Abhi
You can not use calculated column in the Where clause, only in Having Clause.
Your case, unfortunately, is a really tough one, since you would have to select everything first to be able to apply your OR conditions.
If it's not broken, fix it until it is.
My Blog