如何获取计数以显示具有0计数的zip的计数

时间:2019-02-20 21:16:38

标签: sql

下面是我的查询,我需要显示零计数的邮政编码

选择propertyzip as Zip, Zip.city as City, zip.fips as Fips, Propertystate as state, Count(*) as Total From dbo.proplistsource a, Zipcode.dbo.zip Zip, Zipcode.dbo.cnty where cnty.fips = zip.fips and zip.zip = a.propertyzip and zip.ll = 'L' and Propertyzip in ('37849', '37909', '37914', '37918', '37921', '37923', '37931') and a.propid in (Select max(propid) from dbo.proplistsource b where b.Propertyzip in ('37849', '37909', '37914', '37918', '37921', '37923', '37931') and propertyusestandardized in ('181')) group by propertyzip, zip.City, zip.Fips, Propertystate

1 个答案:

答案 0 :(得分:1)

您需要在底部使用having子句,例如:

...<your query>...
having count(*) < 1