Possible Duplicate:
Selecting the Highest Seq Number by nested Joining
Hello I have to write a query , I would like to take biggest sequence number for each client Id (big sequence number will be calculated based on highest bank account balance).
Please consider this table has 100000records.
table is like as below-
Table:
**ClID** **SeqNu** **Bal** 1 1 30000 1 2 26789 1 3 23456 1 4 12345 1 5 21234 2 3 12456 2 4 45632 2 1 23456 2 9 99999 3 4 12345 3 5 21234 3 3 12456 3 4 45632
Result would be
**ClID** **SeqNu** **Bal** 1 1 30000 2 9 99999 3 4 45632
The best way to accomplish this will probably vary depending on which RDBMS you’re using. If you have windowing functions (Oracle 9i+ or SQL Server 2012, for instance), the following should work: