PHP/PDO/MySQL if statement in BETWEEN clause -
i'm trying return records records store within date range. however, if store opened after date, want use open date. possible this? i'm using php pdo , mysql:
select store_name, daily_sales mytable date between (if(open_date > :start_date, open_date, :start_date) , :end_date
so can this:
select store_name, daily_sales mytable date between (select if(open_date > :start_date, open_date, :start_date)) , :end_date
Comments
Post a Comment