I'm using php with Mysql and I need to run a specific query when user selects month and year in a date_field. This query returns all records created by the month/year selected by user and I don't want relate days in a clause where inside the select. Since I need only records from month/year select, is there any ways how can I define inside the select only month/year?
Here is my Mysql statement with variable selected by user There are two tables related with inner join so I can 'grab' records with Date:
$quer_mesano = "Select b.name AS Canal
from canal_canalvenda b
inner join meta_meta c On c.canal_canalvenda_id_c = b.id
And c.deleted = 0
where c.periodo = '$month_year' //Here is the date value I just need to put in month/year
And b.deleted = 0
Group by Canal order by 1";
Can any one help me?
date_format()in particular. - Marc B