>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.
SELECT Client, SUM(production) AS TotalProd FROM ProdTable ;
WHERE ProdDate BETWEEN dFirstDate, dLastDate ;
GROUP BY Client ;
HAVING TotalProd > nMinProduction
>sherry