我在桌面上有一个Oracle查询数量。
SELECT SEI_NO, SUM(T.QUANTITY) AS TOTAL
FROM WA_II_TBL_TR_EQUIPMENT T
WHERE T.SUPPLIERID_FK = '62551'
GROUP BY T.SEI_NO
但现在我想添加至少最后一个ID的列事务ID。
TR_ID | SEI_NO | TOTAL
1 | SDGDFGSD | 2
2 | SDGDFGSD | 2
3 | SDGDFGSD1| 10
我想要展示的内容:
TR_ID | SEI_NO | TOTAL
1 | SDGDFGSD | 4
3 | SDGDFGSD1| 10
有可能吗?
答案 0 :(得分:1)
SELECT min(TR_ID) as TR_ID,
SEI_NO,
SUM(T.QUANTITY) AS TOTAL
FROM WA_II_TBL_TR_EQUIPMENT T
WHERE T.SUPPLIERID_FK = '62551'
GROUP BY T.SEI_NO
这应该是诡计。