I have a problem when passing a date to a select. Using the form below, select me normally returns the data:
SELECT H.* FROM HORARIOS H
WHERE NOT EXISTS (
SELECT * FROM RESERVAS R
WHERE H.COD BETWEEN R.COD_HORA_SAIDA AND
R.COD_HORA_PREVISTA-1 AND
R.COD_VEICULO = 1 AND
R.DATA_SAIDA = '2015-11-26')
ORDER BY H.COD;
But if I try to move to the d-m-a format as below, it does not return the data correctly.
SELECT H.* FROM HORARIOS H
WHERE NOT EXISTS (
SELECT * FROM RESERVAS R
WHERE H.COD BETWEEN R.COD_HORA_SAIDA AND
R.COD_HORA_PREVISTA-1 AND
R.COD_VEICULO = 1 AND
DATE_FORMAT(R.DATA_SAIDA, '%d-%m-%Y') = '26-11-2015')
ORDER BY H.COD;
Can anyone tell me why this way he does not accept it?