Perform a select statement to get lower values by id

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nexusbr
    New Member
    • Dec 2007
    • 15

    Perform a select statement to get lower values by id

    Hi,

    supposedly i have this table:
    Code:
    ID   Value
    1     22
    1     17
    2     14
    2     01
    2     55
    3     20
    4     36
    4     40
    4     51
    4     38
    and i want to select those records only:
    Code:
    ID   Value
    1     17
    2     01
    3     20
    4     36
    which means that i need the lowest values by id..

    seems to be easy enough to accomplish, but i've gotten myself stuck on it...

    thanks for any help
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    will a...

    Code:
    SELECT ID, MIN(Value) from YourTable Group by ID
    work?

    Happy Coding!!!

    ~~ CK

    Comment

    Working...