-
I have a table that contains a column that stores a version number for a record.
S_ID varchar2(10)
VER NUMBER(5)
I want to select out each unique S_ID that contains the highest version number in the VER column.
S_ID VER
XX1 1
XX1 2
XX1 3
XX2 1
XX3 1
I would like to select out each unique S_ID with the highest version number. My resulting selection would be:
S_ID VER
XX1 3
XX2 1
XX3 1
Not sure how to perform this query. WOuld appreciate any ideas. Thanks
-
Try this:
select s_id, max(ver) from table_name group by s_id, it works on me.
Thanks
-
This should work
SELECT S_ID, MAX(VER)
FROM <table)
GROUP BY S_ID
let me know if you need additional help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|