MYSQL case语句在表达式中有多个条件不起作用

时间:2014-09-03 20:30:03

标签: mysql mysql-workbench

我的查询类似于下面的mysql

SELECT
   m.meeting_id,
   m.meeting_date,
   CASE WHEN ( m.meeting_date >= cont.cont_start AND m.meeting_date <= cont.cont_end ) THEN cont.cont_end ELSE '' END as agreement_expires
FROM
meeting m
LEFT JOIN
(
SELECT 
        c.contract_id,
            c.contract_name as name,
            sc.name as speaker_level,
            DATE_FORMAT(c.sent,'%m-%d-%Y') as sent,
            DATE_FORMAT(c.signed,'%m-%d-%Y') as signed,
            DATE_FORMAT(c.start,'%m-%d-%Y')as cont_start,
            DATE_FORMAT(c.end,'%m-%d-%Y') as cont_end,
            xcb.brand_id,
            xcb.project_id,   
            xcs.speaker_id
    FROM
        xref_contract_bureau xcb
    INNER JOIN xref_contract_speaker xcs ON (xcb.contract_id = xcs.contract_id)
    INNER JOIN ref_contract c ON (c.contract_id = xcs.contract_id)
)cont ON (condition)

问题是case语句没有检查两个条件,即使两个条件都为真,也返回空结果。我怀疑我的案例陈述没有写好以检查这两个条件。任何人都可以纠正吗?

0 个答案:

没有答案