View previous topic :: View next topic
|
Author |
Message |
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
hi
i have a table with cols ref_id and version. now the data is
Code: |
ref_id ver
__________
A 1
A 2
A 3
A 4
B 1
B 2 |
now i need a query to get the max version of a ref_id.
ie i need my output rows to be A 4 and B 2
Kindly help. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
OK, have you looked at a SELECT statement and the WHERE clause with a MAX parameter? |
|
Back to top |
|
|
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
Hi ashimer,
SELECT REF_ID, MAX(VER) FROM <TABLE-NAME>
GROUP BY REF_ID.
will give you the maximum VERSION for ever REF_ID |
|
Back to top |
|
|
|