Last active
February 22, 2016 17:00
-
-
Save cesarAugusto1994/5a54178f1eaaa4e401ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
IF(0 < m.data_agendamento, IF(m.data_agendamento < DATE_FORMAT(NOW(), '%Y-%m-%d'), 1,0), | |
IF(0 < pe.data_agendamento_montagem, | |
IF(pe.data_agendamento_montagem < DATE_FORMAT(NOW(), '%Y-%m-%d'), 1, 0), | |
IF(pe.previsao_montagem < DATE_FORMAT(NOW(), '%Y%m%d'), 1, 0)) | |
) AS retorno | |
FROM webpdv.pedidos_entregas pe | |
LEFT JOIN webpdv.montagens m ON (m.id_origem = pe.id_pedido_entrega) | |
WHERE id_pedido_entrega = 46611021; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment