如果订单有多行,您要显示哪个日期?可能:
SELECT [orderId], MAX([datetime])
FROM [table]
GROUP BY [orderId]
ORDER BY MAX([datetime]) DESC
SQL选择不同的值,但按不同的值排序
如果订单有多行,您要显示哪个日期?可能:
SELECT [orderId], MAX([datetime])
FROM [table]
GROUP BY [orderId]
ORDER BY MAX([datetime]) DESC