I'm using this code to try to get the number of parcels that have multiple imps inside a neigh.
SELECT r.neighbhood
,count(CASE
WHEN count(p.repropkey > 1)
THEN 1
ELSE NULL
END) AS 'Multiple Imps'
FROM realprop r
LEFT JOIN reprop p ON r.realkey = p.realkey
WHERE r.fmvres > 0
GROUP BY r.neighbhood
I don't know why you are nesting count()
s. Does this do what you want?
SELECT r.neighbhood,
(CASE WHEN count(p.repropkey > 1) THEN 1
END) AS Multiple_Imps
FROM realprop r LEFT JOIN
reprop p
ON r.realkey = p.realkey
WHERE r.fmvres > 0
GROUP BY r.neighbhood
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.