Jump to content

top 2 most frequent values in column


Vivid Lust

Recommended Posts

PFMaBiSmAd's solution gives you the field name, Pikachu's solution gives you the two highest frequencies.  The former is probably what you're after.

 

If you want the value AND the frequency, just combine the two:

 

SELECT field, COUNT(field) as frequency FROM table GROUP BY field ORDER BY COUNT(field) DESC LIMIT 2

-Dan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.