Peter Nordberg
asked on
Group ordersum by orderdate
Hi,
I posted an almost identical question earlier but closed the question and needed to alter it, so here is a new question.
I have this query looking like this query looking like this:
The result looks like this:
I would like to group so the total sum per orderDate comes, not each order. How can I do it?
Peter
I posted an almost identical question earlier but closed the question and needed to alter it, so here is a new question.
I have this query looking like this query looking like this:
SELECT CONVERT(NVARCHAR(10), o.orderDate, 121) AS date, (SELECT SUM(price) FROM dbo.OrdersDetail AS od WHERE od.oID = o.oID) AS sales
FROM dbo.Orders AS o
INNER JOIN dbo.aspnet_ProfileCustomized AS apc ON apc.sellerID = o.sellerID
WHERE o.saved = 1 AND apc.sellerID = 264 AND MONTH(o.orderDate) = 5 AND YEAR(o.orderDate) = 2017
GROUP BY CONVERT(NVARCHAR(10), o.orderDate, 121)
ORDER BY CONVERT(NVARCHAR(10), o.orderDate, 121)
The result looks like this:
2017-05-02 750,00
2017-05-03 2000,00
2017-05-03 7990,00
2017-05-03 3990,00
2017-05-04 1500,00
2017-05-04 1500,00
2017-05-04 3990,00
2017-05-04 3500,00
2017-05-04 1500,00
2017-05-05 495,00
2017-05-05 1000,00
2017-05-05 495,00
2017-05-08 5000,00
2017-05-09 1500,00
2017-05-10 990,00
2017-05-10 5000,00
2017-05-10 3500,00
2017-05-12 3000,00
2017-05-15 1000,00
2017-05-15 800,00
2017-05-16 1000,00
2017-05-16 800,00
2017-05-17 800,00
2017-05-19 4950,00
2017-05-19 4950,00
2017-05-19 5000,00
2017-05-19 2000,00
I would like to group so the total sum per orderDate comes, not each order. How can I do it?
Peter
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
both solutions worked well. Also thanks for the additional comments to make things better. I appriciate that.
Peter