Craig Beamson
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
- 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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Jim