Home > DeveloperSection > Forums > How to get multiple count in sql
benjamin richards
benjamin richards

Total Post:4

Points:28
Posted on    February-12-2013 2:11 AM

 MSSQL Server MSSQL Server 
Ratings:


 1 Reply(s)
 897  View(s)
Rate this:

Hi MindStickians!

I have a table in my database in which I have three columns:

[Article_ID] INT IDENTITY PRIMARY KEY,
[Article_Title] NVARCHAR(Max),
[Article_Rating] INT

Now the user can enter a maximum number 5 in rating and minimum 1 now I have to query that how many times users entered 1, how many times 2, how many times

3, how many times 4 and how many times 5

Thanks in advance.



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-12-2013 8:54 AM

Hi Benjamin!

Try this SQL Query that fulfill your requirement  

SELECT [ARTICLE_RATING],COUNT(Article_Rating) [Total_Count] FROM [COUNT_DETAILS] GROUP BY [Article_Rating]


Don't want to miss updates? Please click the below button!

Follow MindStick