i have this query which helps me show only the records that have an initiation day equal to today..
I have a yesterday variable..i Need to access like this:
$strSQL = "SELECT forma.*, SMS_MONTIME.IDTICKET, SMS_MONTIME.MBYLLUR,SMS_MONTIME.time_added
FROM forma
LEFT JOIN SMS_MONTIME ON forma.ID = SMS_MONTIME.IDTICKET WHERE forma.data_fillim = '$today' ORDER BY forma.id DESC";
I need to modify it to something like:
$strSQL = "SELECT forma.*, SMS_MONTIME.IDTICKET, SMS_MONTIME.MBYLLUR,SMS_MONTIME.time_added
FROM forma
LEFT JOIN SMS_MONTIME ON forma.ID = SMS_MONTIME.IDTICKET WHERE forma.data_fillim = '$today' AND forma.data_fillim = '$yesterday' ORDER BY forma.id DESC";
Thanks
Shooting in the dark, but how about changing AND to OR? If you already have $yesterday in the same format as $today but just that it is a different date, then you can use OR. Alternatively you may use:
It also depends on what it is you REALLY want to do. If you are expecting a result for items inclusive of $yesterday and $today then you may use:
If you are expecting a result for items that are either $yesterday or $today then you may use the previous snippet above (the one with the IN statement) OR use this
You may use BETWEEN syntax which is true for MySQL and MSSQL. I’m not sure about Oracle:
I hope this helps