Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

This is my query:

SQL
SELECT top(16) LocationName,
COUNT(LocationName) AS TotalCount
FROM
Job where CountryId = 108
GROUP BY LocationName ORDER BY TotalCount DESC


I got the result like this.

1 Banglore 900
2 hyderabad 850
3 vijawada  800
4           200
5 karnataka 100


I dont accept null values in location column, In the above result I dont want 4th row.

Please help me.
Thank you.
Posted

SQL
SELECT top(16) LocationName,
COUNT(LocationName) AS TotalCount
FROM
Job where CountryId = 108
and Location IS NOT NULL
GROUP BY LocationName ORDER BY TotalCount DESC
 
Share this answer
 
v3
Comments
Pranav-BiTwiser 26-May-14 3:48am    
u cannot use WHERE keyword as many as u have used in the above query..
phil.o 26-May-14 7:16am    
Please avoid textspeak on this forum.
Pranav-BiTwiser 26-May-14 3:48am    
it should be seperated by AND
NagaRaju Pesarlanka 26-May-14 4:20am    
your query also got same answere
SQL
SELECT top(5) Title,
COUNT(Title) AS TotalCount
FROM
Job where CountryId = @cntid and Title !=' '
GROUP BY Title ORDER BY TotalCount DESC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900