Find the highest number of occurences in a column in SQL
        Posted  
        
            by 
                Ronnie
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ronnie
        
        
        
        Published on 2011-01-08T19:51:01Z
        Indexed on 
            2011/01/08
            19:53 UTC
        
        
        Read the original article
        Hit count: 332
        
Given this table:
Order
custName description to_char(price)
A        desa $14
B        desb $14
C        desc $21
D        desd $65
E        dese $21
F        desf  $78
G        desg $14
H        desh $21  
I am trying to display the whole row where prices have the highest occurances, in this case $14 and $21
I believe there needs to be a subquery. So i started out with this:
select max(count(price))
from orders
group by price  
which gives me 3.
after some time i didn't think that was helpful. i believe i needed the value 14 and 21 rather the the count so i can put that in the where clause. but I'm stuck how to display that. any help?
© Stack Overflow or respective owner