Link to home
Start Free TrialLog in
Avatar of Craig Beamson
Craig BeamsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Grouped on column A, column B records with "higest count"

I would like to select items from a table:
- Grouped on column_A
- With the value of column_B that has the highest count of records

e.g.
column_A, column_B
car, red
car, red
car, green
motorbike, yellow
motorbike, blue
motorbike, orange
motorbike, orange

I would want the results
column_A, column_B
car, red
motorbike, orange

Where there are equal highest counts, I'm happy to take either value for column_B
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America 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
Avatar of Craig Beamson

ASKER

That does it for me!

Thanks Jim