0
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 does not follow this pattern of day/month/year (this is already dealt with up there). some tables, the column data_enviado
, is as year-day, some others as year/month/day, others like day-month-year; I could do the processing in my php code by checking the tables name, but if there is an easier way to do this by sql...
The ideal was to create a new column of the type
date
with the values you already have in the database, so ends this confusion.– rray