level 1
心机黑boy
楼主
SELECT u.id FROM rtv_user u
WHERE u.`rank`!=0 AND u.status!=2 and u.device='console'
and not EXISTS(select 1 from
(select count(*) as cnt from
(select * from rtv_console_unit_mapping cum where cum.console_id=u.id) cum1,
(select unt.unique_id from rtv_unit_table unt,rtv_user ru
where unt.corp_id=ru.corp_id and unt.state!=2
and unt.id=ru.department_fk_id
and ru.id=65540
) udpt where cum1.dept_unique_id= udpt.unique_id
) as cum2
where cum2.cnt>0
)
执行之后报Unknown column 'u.id' in 'where clause',有什么转换的方式吗
2023年12月14日 09点12分
1
WHERE u.`rank`!=0 AND u.status!=2 and u.device='console'
and not EXISTS(select 1 from
(select count(*) as cnt from
(select * from rtv_console_unit_mapping cum where cum.console_id=u.id) cum1,
(select unt.unique_id from rtv_unit_table unt,rtv_user ru
where unt.corp_id=ru.corp_id and unt.state!=2
and unt.id=ru.department_fk_id
and ru.id=65540
) udpt where cum1.dept_unique_id= udpt.unique_id
) as cum2
where cum2.cnt>0
)
执行之后报Unknown column 'u.id' in 'where clause',有什么转换的方式吗