Link to home
Start Free TrialLog in
Avatar of johnnyg123
johnnyg123Flag for United States of America

asked on

How to select max row per group in SQL

Here is some sample data from the case_text table

company_id    case_id    text_type_code    case_text_seq
MIS                  1              Resolution             21
MIS                  1              Resolution             22
MIS                  2              Resolution             5
MIS                  2              Resolution             6
MIS                  2              Resolution             4

I am trying to create a query that will return the row with the highest case_text_seq value for a given combination of company_id,  case_id,  and  text_type_code    

Using the sample data above, I would like the query results to look like the following:

company_id    case_id    text_type_code    case_text_seq
MIS                  1              Resolution             22
MIS                  2              Resolution             6
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial