我只需要按一列分组
SQL Server 2012 查询:
SELECT OrderID,Status,DateEdited
FROM orders
WHERE Status='Pending'
GROUP BY OrderID,Status,DateEdited
结果是:
如您所见,存在重复的OrderId
列值。
工作,但它分组,OrderId,Status,DateEdit
但我需要的是OrderId
结果将是独一无二的,我可以有类似的东西:
SELECT OrderID,Status,DateEdited
FROM orders
WHERE Status='Pending'
GROUP BY OrderID