Skip to content Skip to sidebar Skip to footer

Find Largest Value Among Repeated Entries In An Sql Table

I have searched desperately for the answer to a seemingly easy query to pull off- but no luck in finding the answer so far. I am hoping someone can at least point me in the right d

Solution 1:

You need to research GROUP BY statement and read about aggregate functions.

MySQL Reference manual can be a great source of knowledge in this case.

select
  color, max(inches) as longest_inches
from
  yourtable
groupby color

It works by grouping all rows with the same value in column color and then retrieving the maximum value amongst each group thus giving you the expected output

Post a Comment for "Find Largest Value Among Repeated Entries In An Sql Table"