473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

counting the no of times a value occured and sorting the fields in a table

In the table the fields are id, first_name, last_name, introduced_by (which is integer value i.e., 1,2,3,4,5...). This number occurs more than once in the table. I have to count the number of times each number occurs(that means a single value for eg: 2) and sort it according to the count and display the output in ascending order..Can u help me?
Jan 29 '08 #1
1 1088
idsanjeev
241 100+
In the table the fields are id, first_name, last_name, introduced_by (which is integer value i.e., 1,2,3,4,5...). This number occurs more than once in the table. I have to count the number of times each number occurs(that means a single value for eg: 2) and sort it according to the count and display the output in ascending order..Can u help me?

Hi Neenaprasad
If I am not wrong then You wants to count duplicate recrds from table
so the select statement is change it according to your need


Expand|Select|Wrap|Line Numbers
  1. SELECT YourColumn, COUNT(*) TotalCount
  2. FROM YourTable
  3. GROUP BY YourColumn
  4. HAVING COUNT(*) > 1
  5. ORDER BY COUNT(*) ASC
  6.  
Jan 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: RickMuller | last post by:
I have to sort a list, but in addition to the sorting, I need to compute a phase factor that is +1 if there is an even number of interchanges in the sort, and -1 if there is an odd number of...
6
by: C White | last post by:
i have been searching online for a few days now, and I can't seem to find the answer for what I am looking for, maybe I just don't know how to phrase it properly for the search engines... at any...
4
by: Chad Reid | last post by:
Hello, I have a bit of code that obviously doesn't work, but I need help creating a query that would have the same effect as if this query was working. SELECT * FROM (SELECT Count(*) AS...
2
by: Glenn Cornish | last post by:
I have 5 fields in a table into which numbers between 1 and 45 can be entered. What I am having trouble with is being able to find out is how many times a particular number appears, regardless of...
10
by: Colleyville Alan | last post by:
I am trying to turn a short and fat (63 columns) table into one that is tall and skinny (7 columns). Basically, I am trying to create a "reverse crosstab" using a looping structure in VBA along...
3
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let...
7
by: sathyashrayan | last post by:
Group, Following function will check weather a bit is set in the given variouble x. int bit_count(long x) { int n = 0; /* ** The loop will execute once for each bit of x set,
0
by: arnuld | last post by:
any comments for improvement: /* C++ Primer - 4/e * * CHAPTER 10 - Associative Containers * * EXERCISE - 10.7 * Write a program to count and print the number of times each word *...
0
by: pvinodhkumar | last post by:
In TAOCP, Volume 3 - Sorting and Searching, Page Number -77, an algorithm for Sorting by Comparision Counting is given. I understand the algorithm. What I do not understand is Knuth has stated that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.