0

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.

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by pty
0

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
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.