select distinct col1 with min(col2) and max(col3) from table
Posted
by user338804
on Stack Overflow
See other posts from Stack Overflow
or by user338804
Published on 2010-05-11T22:56:53Z
Indexed on
2010/05/11
23:04 UTC
Read the original article
Hit count: 213
sql
My table looks like this with duplicates in col1
col1, col2, col3, col4
1, 1, 0, a
1, 2, 1, a
1, 3, 1, a
2, 4, 1, b
3, 5, 0, c
I want to select distinct col1 with max (col3) and min(col2); so result set will be:
col1, col2, col3, col4
1, 2, 1, a
2, 4, 1, b
3, 5, 0, c
I have a solution but looking for best ideas?
© Stack Overflow or respective owner