You can use multiple filters in WHERE
, just put AND
between them.
For an interval between two dates, use BETWEEN
.
Remember that dates need to be in quotation marks and in the format yyyy-mm-dd.
Example below:
SELECT *
FROM TABELA
WHERE
status='1'
and data between '2017-01-13' and '2017-01-20';
Note, this is if your database field is set to DATE.
If you are on DATETIME, you have to use '00: 00: 00 'for the first date '23: 59: 59' for the second.
SELECT *
FROM TABELA
WHERE
status='1'
and data between '2017-01-13 00:00:00' and '2017-01-20 23:59:59';
If it is in DATETIME format and you do not want to worry about setting the time (@Bacco suggestion):
SELECT *
FROM TABELA
WHERE
status='1'
and DATE( data ) between '2017-01-13' and '2017-01-20';
If it is in TIMESTAMP format, you can use UNIX_TIMESTAMP, as suggested by @Inkeliz.