1242 - Subquery returns more than 1 row

子查询出错

返回结果只能有一条,但你写的SQL有多个结果返回就会报错Subquery returns more than 1 row

select * from t_project pj where pj.id =
(select project_id from t_process p where TO_DAYS(p.end_time) = TO_DAYS(NOW()));

解决
=改成=any

select * from t_project pj where pj.id =any
(select project_id from t_process p where TO_DAYS(p.end_time) = TO_DAYS(NOW()));

你可能感兴趣的:(MySQL,mysql)