Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select SQL problem
Message
From
12/04/2022 06:24:05
 
 
To
12/04/2022 02:48:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01684152
Message ID:
01684159
Views:
45
Thank you Borislav.

>>Hello all,
>>
>>I'd like for the following code to work. The where is the important part that doesn't want to cooperate ;-)
>>
>>SELECT Field1, COUNT(IdCase) as TotCases;
>>FROM Table1 ;
>>group by Field1;
>>where TotCases > 3
>>
>>So to only get the rows where TotCases is greater thant 3 how should I code my where?
>
>When you want to filter your result by some of aggregate fields you should use HAVING clause instead of WHERE.
>
>SELECT Field1, COUNT(IdCase) as TotCases;
>FROM Table1 ;
>group by Field1;
>HAVING COUNT(IdCase) > 3 && I use this because SQL Server do not like if I use the result field name
>
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Previous
Reply
Map
View

Click here to load this message in the networking platform