1IF condition1 THEN
2 statements;
3ELSEIF condition2 THEN # OPTIONAL
4 statements;
5ELSE # OPTIONAL
6 statements;
7END IF;
1SELECT * FROM callback LEFT JOIN agent ON callback.agent_ID=agent.agent_ID
2 LEFT JOIN contact ON callback.contact_ID=contact.contact_ID WHERE callback.agent_ID =118
3 AND DATE(callback.cb_dt) =curdate()
4 and Hour(time(callback.cb_dt)) <= Hour(time(UTC_TIMESTAMP()))
5 and
6 (if(Hour(time(callback.cb_dt)) = Hour(time(UTC_TIMESTAMP())),
7 minute(time(callback.cb_dt)) < minute(time(UTC_TIMESTAMP())) and
8 cb_IsDeleted=0 ,cb_IsDeleted=0))
9 and callback.isCalled=0;