首先说明下,case when 是无法与join语句连接的,一般像这种问题把条件判断写在select 后,如下
SELECT r.created,
CASE WHEN r.pro_id = 0 THEN u.real_name
ELSE p.name
END as ok
from ycf_resume r
LEFT JOIN ycf_user u on r.user_id = u.id
LEFT JOIN ycf_project p on r.pro_id = p.id
首先说明下,case when 是无法与join语句连接的,一般像这种问题把条件判断写在select 后,如下
SELECT r.created,
CASE WHEN r.pro_id = 0 THEN u.real_name
ELSE p.name
END as ok
from ycf_resume r
LEFT JOIN ycf_user u on r.user_id = u.id
LEFT JOIN ycf_project p on r.pro_id = p.id