问题是这样的,我有多个表联合查询,出现了一下错误,提示,请各位教一下小弟,谢谢SQL 查询: SELECT a. * , b.supplier_name, c.username, max( d.action_plan_date ) , d.social_total_non_compliance_corrected, d.social_critical_non_compliance_corrected, d.quality_total_non_compliance_corrected, d.quality_critical_non_compliance_corrected
FROM csr a
JOIN supplier b ON a.supplier_id = b.uid
JOIN user c ON b.csr_user_id = c.uid
LEFT JOIN actionplan d ON a.uid = d.csr_id
GROUP BY a.uid
WHERE csr.enable =0
LIMIT 0 , 30 MySQL 返回: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where csr.enable = 0
LIMIT 0, 30' at line 1
FROM csr a
JOIN supplier b ON a.supplier_id = b.uid
JOIN user c ON b.csr_user_id = c.uid
LEFT JOIN actionplan d ON a.uid = d.csr_id
GROUP BY a.uid
WHERE csr.enable =0
LIMIT 0 , 30 MySQL 返回: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where csr.enable = 0
LIMIT 0, 30' at line 1
SELECT a. * , b.supplier_name, c.username, max( d.action_plan_date ) , d.social_total_non_compliance_corrected, d.social_critical_non_compliance_corrected, d.quality_total_non_compliance_corrected, d.quality_critical_non_compliance_corrected
FROM csr a
LEFT JOIN actionplan d ON a.uid = d.csr_id,
supplier b,user c
WHERE csr.enable =0 and a.supplier_id = b.uid and b.csr_user_id = c.uid
GROUP BY a.uid
LIMIT 0 , 30
FROM csr a
LEFT JOIN actionplan d ON a.uid = d.csr_id,
supplier b,user c
WHERE a.enable =0 and a.supplier_id = b.uid and b.csr_user_id = c.uid
GROUP BY a.uid
LIMIT 0 , 30
where csr.enable=0 最好用 where a.enable=0
b.supplier_name, c.username,
max( d.action_plan_date ) ,
d.social_total_non_compliance_corrected,
d.social_critical_non_compliance_corrected,
d.quality_total_non_compliance_corrected,
d.quality_critical_non_compliance_corrected
FROM csr a
JOIN supplier b ON a.supplier_id = b.uid
JOIN user c ON b.csr_user_id = c.uid
LEFT JOIN actionplan d ON a.uid = d.csr_id
WHERE a.enable =0
GROUP BY a.uid
LIMIT 0 , 30
SELECT a. * , b.supplier_name, c.username, max( d.action_plan_date ) , d.social_total_non_compliance_corrected, d.social_critical_non_compliance_corrected, d.quality_total_non_compliance_corrected, d.quality_critical_non_compliance_corrected
FROM csr a
JOIN supplier b ON a.supplier_id = b.uid
JOIN user c ON b.csr_user_id = c.uid
LEFT JOIN actionplan d ON a.uid = d.csr_id
WHERE a.enable =0
GROUP BY a.uid
LIMIT 0 , 30