我有以下查询
SELECT McId, MAX(TimeDone)
FROM Trace
WHERE PcbId = 'C825514362'
AND DeviceId <> 0 GROUP BY McId
但我还需要从以下列
Program
,DeviceId
,OrderNo
中获取值是否可以以某种方式将其合并到同一查询中?
该查询应在mssql,mysql和oracle下运行。
最佳答案
SELECT
McId,
MAX(TimeDone),
Program,
DeviceId,
OrderNo
FROM Trace
WHERE PcbId = 'C825514362' AND DeviceId <> 0
GROUP BY
McId,
Program,
DeviceId,
OrderNo
关于mysql - 分组依据和列选择,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10717541/