SELECT * FROM minhaTabela WHERE status=2
AND nomePessoa='Jose Silva' AND STR_TO_DATE(data_enviado, '%d/%m/%Y')
BETWEEN STR_TO_DATE('01/05/2015', '%d/%m/%Y')
AND STR_TO_DATE('31/06/2015', '%d/%m/%Y')
is there any way to do an if / else?
I have other tables that date do not follow this pattern of day / month / year (this is already treated there above). some tables, column data_enviado
, is like year-month-day , some others such as year / month / day , others like day-month-year ; I could do the processing in my php code by checking the name of the tables, but if there is an easier way to do this through sql ...