I am having a huge SELECT where I need to make some conditions.
Eg:
SELECT `t`.`title`, `t`.`price_paid`, `t`.`date_creation`, `t`.`date_upload`
FROM `table_name` AS `t`
WHERE `t`.`date_creation` >= "'.$year.'-'.$month.'-01"
AND `t`.`date_creation` < "'.$year.'-'.($month+1).'-01"
I declare in PHP the values of $year and $month and I want the rest to be made in MYSQL (I have strong reasons I can detail if needed)
What I need is to make the date_upload empty (null or 0) and price also empty if the date_upload is not from the same interval as t.date_creation