468,257 Members | 1,418 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

For every value (column a) return * where column b is maximum

I have 4 columns a ,b ,c, d

sample data

a | b | c | d |

1 | 1 | 101 | 0
2 | 1 | 101 | 0
3 | 1 | 101 | 1
4 | 1 | 102 | 0
5 | 1 | 102 | 0
1 | 2 | 101 | 0
2 | 2 | 101 | 1

Write a SQL command such that it should return those rows where for every value of c in b, return rows with maximum a

i.e
Expect output

a | b | c | d |

3 | 1 | 101 | 1
5 | 1 | 102 | 0
2 | 2 | 101 | 1
Jul 11 '20 #1
1 2069
Banfa
9,033 Expert Mod 8TB
And what have you already tried?
Jul 12 '20 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by R. Santiago | last post: by
reply views Thread by ChuckB | last post: by
1 post views Thread by orenl | last post: by
2 posts views Thread by Mariano | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.