•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 422,977 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,934 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 2077 | Replies: 2
![]() |
•
•
Join Date: Jul 2006
Posts: 17
Reputation:
Rep Power: 3
Solved Threads: 0
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
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
•
•
Join Date: Feb 2005
Location: Braintree, UK
Posts: 1,165
Reputation:
Rep Power: 7
Solved Threads: 59
select top 1 area, countarea from( select area, count(area) countarea from callers group by area ) areacount order by countarea desc
Last edited by hollystyles : Jul 7th, 2006 at 7:36 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- how to delete duplicate record in a table by using SQL query (MS SQL)
- sql query problem with MS Access and C# (C#)
- Hi,Need help on sql select statement structure (MS SQL)
- SQL Query - rarely issue (ASP.NET)
- C# VS 2005 - SQL Query Parameters to an ODBC DataSource (C#)
- sql query updating problem (Visual Basic 4 / 5 / 6)
- Please help me out with MySQL query (MySQL)
- PHP/SQL query help (PHP)
- Program Problem with a select statement to access Data base (C)
Other Threads in the MS SQL Forum
- Previous Thread: Setting Roles and Users in MS SQL
- Next Thread: Help Editing Trigs, Stored Procs, and Fkeys



Linear Mode