DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Select Statement Assistance

  1. #1
    Join Date
    Dec 2000
    Posts
    5

    Question

    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



  2. #2
    Join Date
    Oct 2000
    Posts
    123
    Try this:

    select s_id, max(ver) from table_name group by s_id, it works on me.

    Thanks

  3. #3
    Join Date
    Jan 2001
    Posts
    4
    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
  •  


Click Here to Expand Forum to Full Width