select groupId
,case
when
(select count(*) from event_attendees_mapping where
event_schedule_id=scheduleId and employee_code='TJU_741')>0 then 1
else 0 end as isMyEvent from EventList_View
使用此查询我在运行时创建新列并提供如下数据:
groupId isMyEvent
'1', '0'
'2', '0'
'3', '0'
'4', '1'
'1', '0'
'2', '0'
'3', '0'
现在我将此查询应用于获取仅使用此查询isMyEvent
为1的记录:
select groupId
,case
when
(select count(*) from event_attendees_mapping where
event_schedule_id=scheduleId and employee_code='TJU_741')>0 then 1
else 0 end as isMyEvent from EventList_View where isMyEvent=1
当我执行此查询时,我收到错误:
Error Code: 1054. Unknown column 'isMyEvent' in 'where clause'
你能否告诉我我在哪里做错了我想在执行上一次查询时获取数据:
groupId isMyEvent
4 1
请建议我。