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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vedantbah
    New Member
    • Jul 2020
    • 1

    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
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    And what have you already tried?

    Comment

    Working...