Sunday, March 11, 2012

Datagrid dataset problem

For a datagrid dataset, I'm trying to take the amount of all the sales by a salesperson
in two days and create an alias for sum(saleamount) (which would become
allsales) to put the grand total in.

select
thedate, sum(saleamount) as allsales , salesperson, orderID
from
transactions
WHERE (thedate IN ('6/1/2005', '6/2/2005'))
GROUP BY Salesperson
HAVING SUM(allsales > 0)

I'm getting "invalid syntax near SUM (on the Having clause)" when trying to run this
query. And I know there is data in there meeting this criteria.
Thanks
chumley

Try moving the closign parenthesis behnd he column you are summing:
HAVING SUM(allsales) > 0