从计划中选择日期

时间:2014-11-23 19:12:57

标签: mysql sql select

所以我制作了这段代码:

SELECT 
    day.weekday
FROM
    day,
    event,
    event_date
WHERE
    EXISTS( SELECT 
            day.weekday
        FROM
            day)
        AND event.event_id = event_date.event_id
        AND event.day= day.day
GROUP BY day.weekday

它正在运作,但还有其他方法可以使用EXSISTS吗?

1 个答案:

答案 0 :(得分:3)

试试这个

SELECT 
    day.weekday
FROM
    day
    JOIN event ON event.day= day.day
    JOIN event_date ON event.event_id = event_date.event_id
GROUP BY 
    day.weekday