我在删除sqlquery结果中的空值时遇到问题。 [英] I have a problem deleting null values in sqlquery result.
本文介绍了我在删除sqlquery结果中的空值时遇到问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的疑问:
SELECT top ( 16 )LocationName,
COUNT(LocationName) AS TotalCount
FROM
工作其中 CountryId = 108
GROUP BY LocationName ORDER BY TotalCount DESC
我得到了这样的结果。
1 Banglore 900
2 hyderabad 850
3 vijawada 800
4 200
5 karnataka 100
我不接受位置栏中的空值,在上面的结果中我不想要第4行。
请帮帮我。
谢谢。
解决方案
SELECT top ( 16 )LocationName,
COUNT(LocationName) AS TotalCount
FROM
作业其中 CountryId = 108
和位置 IS NOT NULL
GROUP BY LocationName ORDER BY TotalCount DESC
SELECT top ( 5 )标题,
COUNT(Ti tle) AS TotalCount
FROM
作业其中 CountryId = @ cntid 和标题!= ' '
GROUP BY 标题 ORDER BY TotalCount DESC 跨度>
Hi,
This is my query:
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.
解决方案
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
SELECT top(5) Title, COUNT(Title) AS TotalCount FROM Job where CountryId = @cntid and Title !=' ' GROUP BY Title ORDER BY TotalCount DESC
这篇关于我在删除sqlquery结果中的空值时遇到问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文