Skip to content

MySQL query Filter

Ekrem Tapan

Ekrem Tapan

Asked Oct 6, 2015, 6:42 AM EDT1 answer
Share
LinkedInX
Hello Everybody
 
i have a this query
 
Select * from Data Where SiteID=?SiteID and MainSID=?MainSID and AreaID=?AreaID and ContentType=?ContentType and now() >= DisplaySDate And now() < DisplayEDate order by SBID asc"
this query for site main banner then i want to show banner on mainpage when i not input DisplaySDate and DisplayEDate, so how to change this part
now() >= DisplaySDate And now() < DisplayEDate
 
i`m thinking this way but not working = ==
 
if(now() >= DisplaySDate, DisplaySDate = '0000-00-00 00:00:00') And if(now() < DisplayEDate, DisplayEDate='0000-00-00 00:00:00')
 
so you r guys have an any idea for this problem

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Ekrem Tapan
    0
    Solved! 
     
    changed like that below then solved this problem 
     
     if(now() >= DisplaySDate, DisplaySDate IS NULL) And if(now() < DisplayEDate, DisplayEDate IS NULL)
    0