有什么方法可以跳过为空或为空的行?我可以使用一些帮助来排序子表的输出。我的having
语句返回了我无法解决的错误。
它返回错误:ERROR: invalid input syntax for integer: " "
这似乎是因为表中的某些行将具有null值或为空,并且haveing语句正挂在那里。
这是完整的查询
SELECT
count(job),
year,
zipcode
FROM
(
SELECT
substring (cast(dobjobs.prefilingdate AS varchar), '^\d\d\d\d') AS year,
dobjobs.job,
dobjobs.bbl,
pluto_17v1.zipcode
FROM
dobjobs
JOIN pluto_17v1 ON dobjobs.bbl = pluto_17v1.bbl
GROUP BY
dobjobs.prefilingdate,
dobjobs.bbl,
pluto_17v1.zipcode,
dobjobs.job
ORDER BY
year
) AS sub
GROUP BY
year, zipcode
HAVING
CAST( zipcode AS int ) IN (10039, 10039, 10026, 10030, 10037, 10027, 10032, 10033, 10040, 10034, 10031)
ORDER BY
year;