Hi,
Sorry stuck on this query, since I have the data in the order by clause it tells me I have to put in an aggregate or group by clause? (even if I don't need that aggregate value?).
Table UserData ( userID, sales, credits, dateCreated)
My query has to return the last 10 results:
SELECT TOP 10 COUNT(*) as totalDays, SUM(sales), SUM(credits) FROM UserData WHERE userID = @userID ORDER BY dateCreated DESC
I have totalDays because maybe it won't return the # of days I asked for (in this case it is 10, but it can be changed later).