我只需要按一列分组
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