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:
01328067
Views:
18
>I can't get this running total query to work.
>
>
>SELECT	OrderId,
>		UnitPrice,
>		Quantity,
>		UnitPrice * Quantity AS RowAmt,
>		(SELECT SUM(UnitPrice * Quantity) AS RunningTot
>			FROM [Order Details]
>			WHERE OrderId = o.OrderId)
>	FROM [Order Details] o
>
>
>I get "Incorrect syntax near the keyword 'FROM'." on the inner query.
>
>

You're just missing one parens. I corrected inline.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform