Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create A Running Total In A Query
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01327963
Message ID:
01328094
Views:
15
>>Thanks.
>>
>>Ok, now try this. The running total column isn't quite right:
>>
>>
>>
>>USE Northwind
>>
>>SELECT	OrderId,
>>		UnitPrice,
>>		Quantity,
>>		UnitPrice * Quantity AS RowAmt,
>>		(SELECT SUM(UnitPrice * Quantity)
>>			FROM [Order Details]
>>			WHERE OrderId = o.OrderId)  AS 'Running Total'
>>	FROM [Order Details] o
>>
>
>I don't have Nortwind here. But this is not the running total, this is just a sum of all order details for each Order record. What exactly did you want to produce? Running total usually involves dates.

Yes, I want a running total. I'm not too sure how to do that.
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform