#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0

    Problem with writting query


    Hi all,

    I have problem with query.

    I have table like thah:

    col1 col2 col3
    aaa 10 15
    aaa 11 0
    aaa 12 0
    ab 13 0
    ab 14 0
    acc 15 13
    acc 16 0
    acc 17 0

    and have problem with write query that give me result:
    col1 col2 col3
    aaa 10 15
    ab 13 0
    acc 15 13

    Anyone has an Idea?

    Regards,
    kuba14
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,374
    Rep Power
    391
    Code:
    select col1,
           col2,
           col3
      from nameWithheld nwh
     where col2 in
          (select min(col2)
             from nameWithheld
            where nameWithheld.col1 = nwh.col1)

IMN logo majestic logo threadwatch logo seochat tools logo