Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00397845
Message ID:
00397866
Views:
8
>Hello,
> I try to select all the clients who have certain number in total production in a given date range. Could I use one sql statement to accomplish this task ? I do it in two steps: 1)sum up productions for all the clients. 2) select the records which have production more than a specific number. Any better idea ? Thanks.
>sherry

Sherry, try something like

SELECT client_name, SUM(production) AS prodsum ;
FROM mytable ;
GROUP BY clientname ;
HAVING prodsum >= myspecificnumber
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform