Hello again. I'm a newbie who is learning SQL via SQL Server Express. I've gotten a nearby expert to give me some test questions based on Adventureworks, and I get so far before I hit a wall and go looking for clues. Here's today's edition...
The question is, "List the total sales dollar amount for all invoices with more than 4 distinct items."
With that in mind, I cam up with this little bit of stuff that SEEMS to at least give me everything BUT the total amount, the sum of the Line Total column...
SELECT SalesOrderID, COUNT () AS Num_Of_Items, SUM (LineTotal) As 'Amount'
GROUP BY SalesOrderID
HAVING COUNT() > 4;
Getting the sum of that right column seems like it oughta be easy enough, but I can't figure out how to do it! I've probably gone about this all wrong, but I'm trying. With repetition comes familiarity and all that, so I appreciate the assist and patience from you fine experienced folk!