Max count

  • Hi

    I'm having some difficulties to query a table for some values. Here i go.. 

    I have 3 colums

     

    col1      col2       col3

    0          0            0

    0          1            0

    0          2            2

    1          0            0

    1          1            2

    1          2            3

     

    Basically i want to obtain the result for the max value of col3 based on col 1  ie

    col1          col3

    0               2

    1               3

    Is there any query that i can use to get this?

     

    Thanks a lot

     

  • Select col1, max(col3) as MaxCol3 from tbl group by col1

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi

     

    Thanks a lot you have saved me a lot of trouble..

    appreciate your help

     

    Cheers

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply