我在 Mysql 中有 2 个表,一个是承包商,另一个是项目,我想生成一个承包商项目报告,显示项目的批准。问题是 INNER JOIN、LEFT 和 RIGHT OUTER JOIN,都产生相同的结果,即使我忽略了看起来很奇怪的情况,也只会显示承包商的项目。这是我的陈述
SELECT DISTINCT (tbl_contractor.name_v), count( tbl_project.name_v )
FROM tbl_contractor
INNER JOIN tbl_project
ON tbl_project.Contractor=tbl_contractor.contractor_id_v
ON tbl_project.Contractor = tbl_contractor.contractor_id_v
LIMIT 0 , 30;
SELECT DISTINCT (tbl_contractor.name_v), count( tbl_project.name_v )
FROM tbl_contractor
LEFT OUTER JOIN tbl_project
ON tbl_project.Contractor = tbl_contractor.contractor_id_v
LIMIT 0 , 30;