我有一個表,看起來像這樣在Oracle DB:排序由最大值
TransactionID Customer_id Sequence Activity
---------- ------------- ---------- -----------
1 85 1 Forms
2 51 2 Factory
3 51 1 Forms
4 51 3 Listing
5 321 1 Forms
6 321 2 Forms
7 28 1 Text
8 74 1 Escalate
而且我希望能夠理清所有行sequence
最高爲每customer_id
。 我有一個MAX()
函數我可以使用的順序,但基於customer_id
莫名其妙?
我想查詢的結果是這樣的:
TransactionID Customer_id Sequence Activity
---------- ------------- ---------- -----------
1 85 1 Forms
4 51 3 Listing
6 321 2 Forms
7 28 1 Text
8 74 1 Escalate
只是使用'MAX(),那麼組by' .. –