How to combine GROUP BY and ROW_NUMBER?
Wow, the other answers look complex – so I’m hoping I’ve not missed something obvious. You can use OVER/PARTITION BY against aggregates, and they’ll then do grouping/aggregating without a GROUP BY clause. So I just modified your query to: select T2.ID AS T2ID ,T2.Name as T2Name ,T2.Orders ,T1.ID AS T1ID ,T1.Name As T1Name ,T1Sum.Price FROM … Read more