Reputation: 21
I want to get most one repeated value in sql table column field below is my sql structure.
I want to get most repeated value from Topic field
Table name is Orange
and field name with values is topic
topic 1 2 1 3 1 2
Upvotes: 0
Views: 1318
Reputation: 33542
select topic, count(topic) from orange group by topic order by count(topic) desc;
That is the SQL query to run btw.
Upvotes: 0
Reputation: 91
SELECT count(topic)
FROM Orange
GROUP BY topic
ORDER BY count(topic) DESC
Upvotes: 2
Reputation: 4686
What you're looking for here is the Modal average - check this link that has an example of Modal operations in Sql Server and adapt as required.
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/calculating-mean-median-and-mode-with-sq
Upvotes: 0