I am trying to retrieve all data from table in a specific month, my date format in the database table is 2016-06-19
I am need to find with the respect of a selected date,
like if I select 2016-05-22
it will retrieve 2016-05-07
to 2016-06-06
interval values from the table.
And also to all the values in this month which is 05
month, I am using mysqli
with PHP
I have tried using this query
SELECT * FROM t_tenancy_details WHERE agreement_date >= DATE_FORMAT( CURRENT_DATE - INTERVAL 1 MONTH, '%Y/%m/01' )AND agreement_date < DATE_FORMAT( CURRENT_DATE, '%Y/%m/01' )
This works fine for the running month, But problem is that If i select a previous month it does not work. If my question is not perfect please don't down vote me I will loss the eligibility of asking. Thank you.
Aucun commentaire:
Enregistrer un commentaire