使用与运算符所在的联接时的SQL查询错误

时间:2017-01-28 08:34:32

标签: mysql sql

这些是我的表

enter image description here

enter image description here

我正在尝试编写一个查询,我可以在事件表或特定日期表中的specific_date中搜索天气搜索天气的开始和结束日期之间的日期,并从事件中检索记录

例如:

select * from events left join specificdates on events.event_id=specificdates.event_id WHERE ('2017-01-29' BETWEEN events.start_date AND events.end_date) OR  ('2017-01-29' IN 
    specificdates.spefific_date)

1 个答案:

答案 0 :(得分:1)

尝试这个

 select * from events left join specificdates on events.event_id=specificdates.event_id
 WHERE ('2017-01-29' BETWEEN 
 events.start_date AND events.end_date) OR  (specificdates.spefific_date IN ('2017-01-29'))