Results 1 to 3 of 3

Thread: select minimum third column

  1. #1
    Join Date
    Apr 2021
    Posts
    3

    select minimum third column

    Hi Gurus,

    Need some help on select statement below:

    col1|col2|col3
    1|10485890|10485890:259|
    1|10485890|10485890:264|
    1|10485890|10485890:269|
    1|10485890|10485890:274|
    1|10485890|10485890:279|
    1|10485890|10485890:284|
    1|10485890|10485890:289|
    1|10485890|10485890:294|
    1|10485890|10485890:299|
    1|10485890|10485890:304|
    1|10485890|10485890:309|
    1|10485890|10485890:314|
    1|10485890|10485890:319|
    1|10485890|10485890:324|
    1|10485890|10485890:329|
    1|10485890|10485890:334|
    1|10485890|10485890:338|
    1|14680067|14680067:330|
    1|14680067|14680067:325|
    1|14680067|14680067:320|
    1|14680067|14680067:315|
    1|14680067|14680067:310|
    1|14680067|14680067:305|
    1|14680067|14680067:300|
    1|14680067|14680067:262|
    1|14680067|14680067:292|
    1|14680067|14680067:287|
    1|14680067|14680067:282|
    1|14680067|14680067:277|
    1|14680067|14680067:272|
    1|14680067|14680067:267|
    1|14680067|14680067:258|
    1|11534340|11534340:260|
    1|11534340|11534340:265|
    1|11534340|11534340:270|
    1|11534340|11534340:275|
    1|11534340|11534340:280|
    1|11534340|11534340:285|
    1|11534340|11534340:290|
    1|11534340|11534340:295|
    1|11534340|11534340:298|
    1|11534340|11534340:303|
    1|11534340|11534340:308|
    1|11534340|11534340:313|
    1|11534340|11534340:318|
    1|11534340|11534340:323|
    1|11534340|11534340:328|
    1|11534340|11534340:333|
    1|13631491|13631491:262|
    1|13631491|13631491:267|
    1|13631491|13631491:272|
    1|13631491|13631491:277|
    1|13631491|13631491:282|
    1|13631491|13631491:287|
    1|13631491|13631491:292|
    1|13631491|13631491:258|
    1|13631491|13631491:300|
    1|13631491|13631491:305|
    1|13631491|13631491:310|
    1|13631491|13631491:315|
    1|13631491|13631491:320|
    1|13631491|13631491:325|
    1|13631491|13631491:325|
    1|13631491|13631491:330|
    1|13631491|13631491:335|
    2|13631491|13631491:519|
    2|13631491|13631491:524|
    2|13631491|13631491:529|
    2|13631491|13631491:534|
    2|13631491|13631491:539|
    2|13631491|13631491:544|
    2|13631491|13631491:549|
    2|13631491|13631491:553|
    2|13631491|13631491:557|
    2|13631491|13631491:562|
    2|13631491|13631491:567|
    2|13631491|13631491:572|
    2|13631491|13631491:577|
    2|13631491|13631491:582|
    2|13631491|13631491:587|
    2|11534340|11534340:515|
    2|11534340|11534340:520|
    2|11534340|11534340:525|
    2|11534340|11534340:530|
    2|11534340|11534340:535|
    2|11534340|11534340:540|
    2|11534340|11534340:545|
    2|11534340|11534340:550|
    2|11534340|11534340:592|
    2|11534340|11534340:558|
    2|11534340|11534340:563|
    2|11534340|11534340:568|
    2|11534340|11534340:573|
    2|11534340|11534340:578|
    2|11534340|11534340:583|
    2|11534340|11534340:588|
    2|14680067|14680067:521|
    2|14680067|14680067:526|
    2|14680067|14680067:531|
    2|14680067|14680067:536|
    2|14680067|14680067:541|

    Hi Gurus,

    I am trying to get the minimum or least value of "col3" column, group by 1,2. However it returned incorrect result.

    I tried select col1, col2, min(col3) from table
    group by 1,2

    The last column is defined as varchar(100) and it has ":" character.

    I am expecting the results:

    1|10485890|10485890:259|
    1|14680067|14680067:330|
    1|11534340|11534340:260|
    1|13631491|13631491:262|
    2|13631491|13631491:519|
    2|11534340|11534340:515|
    2|14680067|14680067:521|

    Is there any help around here?

    Thank you in advance.
    Last edited by ronaldo; 04-03-2021 at 08:54 AM.

  2. #2
    Join Date
    Apr 2021
    Posts
    3
    1|10485890|10485890:259|
    1|14680067|14680067:330|
    1|11534340|11534340:260|
    1|13631491|13631491:262|
    2|13631491|13631491:519|
    2|11534340|11534340:515|
    2|14680067|14680067:521|

  3. #3
    Join Date
    Apr 2021
    Posts
    3
    I am trying to get the minimum or least value of "col3" column, group by 1,2. However it returned incorrect result.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •