📜  MySQL IF 没有 else - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:55.634000             🧑  作者: Mango

代码示例2
SELECT * FROM callback LEFT JOIN agent ON callback.agent_ID=agent.agent_ID 
    LEFT JOIN contact ON callback.contact_ID=contact.contact_ID WHERE callback.agent_ID =118
    AND DATE(callback.cb_dt) =curdate() 
    and Hour(time(callback.cb_dt)) <= Hour(time(UTC_TIMESTAMP()))
    and 
    (if(Hour(time(callback.cb_dt)) = Hour(time(UTC_TIMESTAMP())),
     minute(time(callback.cb_dt)) < minute(time(UTC_TIMESTAMP())) and
    cb_IsDeleted=0 ,cb_IsDeleted=0))
    and callback.isCalled=0;