My take on your issue is to construct a derived table of the neighborhoods values you hope to find, and LEFT JOIN to the actual table: SELECT x.neighborhoods, COALESCE(mt.incidents, 0) AS incidents FROM (SELECT 'Old Town' AS neighborhoods FROM DUAL UNION ALL SELECT 'New Town' FROM DUAL) xLEFT JOIN MYTABLE mt ON mt.neighborhoods = x.neighborhoods 这篇关于当where子句中的术语不在数据库中时,如何从MySQL数据库返回0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-07 20:03