Hi
I have a query that works ok (see below)
select sum(TotalSellPrice), sum(TotalCostPrice), sum(TotalVolume)
from OrderHeader
WHERE (DateTimeCreated >= DATEADD(wk, DATEDIFF(wk, 0, GETDATE()), 0)AND DateTimeCreated < DATEADD(wk, DATEDIFF
(wk, 0, GETDATE()),8))AND OrderStatus <> 0 AND OrderStatus <> 1 AND OrderStatus <> 2 AND OrderStatus <> 7 AND OrderStatus <>8
what I am trying to do is add in a row that calculates
TotalSellPrice - TotalCostPrice / TotalSellPrice AS Margin
I added this in below the select row but I get eroor messages, how can I add it in and then group by DateTimeCreated
Thanks
I have a query that works ok (see below)
select sum(TotalSellPrice), sum(TotalCostPrice), sum(TotalVolume)
from OrderHeader
WHERE (DateTimeCreated >= DATEADD(wk, DATEDIFF(wk, 0, GETDATE()), 0)AND DateTimeCreated < DATEADD(wk, DATEDIFF
(wk, 0, GETDATE()),8))AND OrderStatus <> 0 AND OrderStatus <> 1 AND OrderStatus <> 2 AND OrderStatus <> 7 AND OrderStatus <>8
what I am trying to do is add in a row that calculates
TotalSellPrice - TotalCostPrice / TotalSellPrice AS Margin
I added this in below the select row but I get eroor messages, how can I add it in and then group by DateTimeCreated
Thanks