SQL query to get the total count [Resolved]

Posted by Chaithragm under Sql Server on 2/5/2013 | Points: 10 | Views : 1338 | Status : [Member] | Replies : 5
I have an authentication table where i am storing the registration_type as column
registration_type

teacher
student
institute
student
student

these are the data in the column ,I need to get the total count(teacher),total count(student),total count(institute) in single query.
student=3
teacher=1
institute=1




Responses

Posted by: Pandians on: 2/5/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Check It Out!
SELECT registration_type, COUNT(1) [Count] FROM [authentication]

GROUP BY registration_type


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 2/5/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
SELECT registration_type, COUNT(*) AS 'Count'
FROM register
GROUP BY registration_type

If this post helps you mark it as answer
Thanks

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shubham on: 2/5/2013 [Member] Starter | Points: 25

Up
0
Down
Hi !!! you can do like that

SELECT COUNT(name) AS customername FROM tablname
WHERE name='your name'

Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 2/5/2013 [Member] Bronze | Points: 25

Up
0
Down
SELECT registration_type, COUNT(registration_type) Count FROM authentication GROUP BY registration_type

Thanks
Pavan Kumar
Mark Answer if this fits the need

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chaithragm on: 2/5/2013 [Member] Starter | Points: 25

Up
0
Down
Thank u all

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response