我有一个MySQL查询,它用于显示某些事件。事件类型和etype将根据某人在表单中选择的内容而更改。
下面是根据网页上的表单添加到查询中的内容。
事件类型为“54”,类型为“sp”
完整查询是
select tevent.event_name, tevent.event_type, min(e_dates.event_date) as eventdate,
tevent.status, tevent.etype
from (tevent LEFT JOIN event_dates on tevent.eventid=event_dates.eventid)
Where status <> 'delete'
AND YEAR(e_dates.event_date) >= YEAR( CURDATE( ) ) and event_type = '54' and etype = 'SP')
group by tevent.eventid
order by (case when tevent.status = 'closed' and e_dates.event_date >= curdate() then 0 else 1 end),
(case when find_in_set(`status`, 'open,pending,approved') then 0 else 1 end),
e_dates.event_date asc, tevent.eventid ASC
这完全符合我的需要。我显示了属于特定事件类型和事件类别的所有事件。
但是,我希望所有查询都包含以下语句
(事件类型为54,类型为SM)或(事件类型为50,以及
事件_prelim='2'))
上面的声明将把研讨会添加到所有的事件日历中,但也将根据人员选择的内容显示每个特定的事件类型。
我希望我的解释不会令人困惑。