View previous topic :: View next topic
|
Author |
Message |
aryanpa1
New User
Joined: 26 May 2007 Posts: 45 Location: Chennai
|
|
|
|
Hi Team ,
I have a DB2 table called sudent_info. I need to get the count of people with the same name.
Example : The table containing data as below
STU_NO STU_NAME
1 ---------- A
2 ---------- B
3 ---------- A
4 ---------- C
5 ---------- B
6 ---------- A
I need the result like
Name Count
A ------ 3
B ------ 2
C ------ 1
Can you please suggest. |
|
Back to top |
|
|
Suresh Ponnusamy
Active User
Joined: 22 Feb 2008 Posts: 107 Location: New York
|
|
|
|
Hi
Please try this
SELECT STU_NAME ,COUNT(STU_NAME)
FROM
STUDENT_INFO
GROUP BY STU_NAME |
|
Back to top |
|
|
aryanpa1
New User
Joined: 26 May 2007 Posts: 45 Location: Chennai
|
|
|
|
Thank you very much Suresh it worked. |
|
Back to top |
|
|
Suresh Ponnusamy
Active User
Joined: 22 Feb 2008 Posts: 107 Location: New York
|
|
|
|
Hi Pavan
You are welcome |
|
Back to top |
|
|
|