SELECT a.telegram_name, a.full_name, a.role_id, a.user_id
from tbl_telegram_user a
LEFT JOIN (
select a.owner_id, a.owner_name from tbl_agenda as a
join (
select a.type, a.message, a.status from tbl_message as a
join tbl_status as b
join (select * from tbl_agenda as a join tbl_message as b
on a.type = b.type
where a.type="/mom" and ( current_date BETWEEN from_time and to_time ) is not null)
on a.status = b.status
where b.status_type = 'workLocation' or b.status_type = 'off') as b
on a.type = b.type
where DATE(a.from_time) = DATE('2021-08-10 21:04:02')) as b
on a.telegram_name = b.owner_name
where b.owner_name is null AND a.user_id <> 0
我认为在第 9 行你忘记了别名:
SELECT a.telegram_name, a.full_name, a.role_id, a.user_id from tbl_telegram_user a LEFT JOIN ( select a.owner_id, a.owner_name from tbl_agenda as a join ( select a.type, a.message, a.status from tbl_message as a join tbl_status as b join (select * from tbl_agenda as a join tbl_message as b on a.type = b.type where a.type="/mom" and ( current_date BETWEEN from_time and to_time ) is not null) as "your alias" on a.status = b.status where b.status_type = 'workLocation' or b.status_type = 'off') as b on a.type = b.type where DATE(a.from_time) = DATE('2021-08-10 21:04:02')) as b on a.telegram_name = b.owner_name where b.owner_name is null AND a.user_id <> 0
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句