我有一个表,看起来像这样在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' .. –