Hi,I'm new to daniweb forum. I hope someone could help.

I have a table called Caller which has a field called Area. I need to select the value of the record in this field that repeats the most. For example

Area
Sel
KL
Sel
Sel
Pen
KL

which means i want the answer as Sel because Sel is the higest number that repeated in the Area Column which is three(3) times. KL repeated twice and Pen once. I want to be able to write an SQL statement that could do this.

Can someone help pls. I've tried max but it didnt work. Thank you

Recommended Answers

All 2 Replies

select top 1 
	area, countarea 
from(

	select 
		area, count(area) countarea 
	from 
		callers 
	group by 
		area

	) areacount
 
 order by 
	countarea desc

Hi hollystyles,

thanx for the great help.It works.

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.