Hi,

Is there any way of finding the modal (most frequent) occurrence of a value. I know that mode doesn't exist in the same way that count, avg and max do but is there any way to combine count and max in such a way to find the most frequent value.

I have a table with people doing different types of events and I need to find for each person what the most frequent event type for them is.

Any help would be very appreciated.

Regards
Andy.

Hi,

Is there any way of finding the modal (most frequent) occurrence of a value. I know that mode doesn't exist in the same way that count, avg and max do but is there any way to combine count and max in such a way to find the most frequent value.

I have a table with people doing different types of events and I need to find for each person what the most frequent event type for them is.

Any help would be very appreciated.

Regards
Andy.

select top 1 with ties your_column
from your_table
group by your_column
order by count(*) desc
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.