mysql语句错误 求高手指点
Unknowncolumn'sc_sucai.id'in'whereclause'[SQL语句]:SELECTsc_sucai.*,`id_count`,sc_users...
Unknown column 'sc_sucai.id' in 'where clause' [ SQL语句 ] :
SELECT sc_sucai.*,`id_count`,sc_users.id as user_id,sc_users.user_nicename,sc_users.avatar FROM `sc_sucai` left join (select count(*) as id_count,sc_id,type from sc_sucai_deal where sc_id=sc_sucai.id ) as b on sc_sucai.id=b.sc_id INNER JOIN sc_users ON sc_users.id = sc_sucai.father_id 展开
SELECT sc_sucai.*,`id_count`,sc_users.id as user_id,sc_users.user_nicename,sc_users.avatar FROM `sc_sucai` left join (select count(*) as id_count,sc_id,type from sc_sucai_deal where sc_id=sc_sucai.id ) as b on sc_sucai.id=b.sc_id INNER JOIN sc_users ON sc_users.id = sc_sucai.father_id 展开
展开全部
正确的应该是这样子的吧?where条件写错了
SELECT sc_sucai.*,`id_count`,sc_users.id as user_id,sc_users.user_nicename,sc_users.avatar
FROM `sc_sucai`
left join (select count(*) as id_count,sc_id,type from sc_sucai_deal group by sc_id,type ) as b
on sc_sucai.id=b.sc_id
INNER JOIN sc_users ON sc_users.id = sc_sucai.father_id
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询