I have a DB full of deals, and a website which will present just one of these deals if the deal is a featured deal, however I am struggling to get the right logic... the deal that is shown on the site must a. be within a valid date range b. be the most recently added deal to the database
by using the following query, I am able to accomplish this:
"SELECT * FROM deals WHERE datestart < now() AND dateend > now() ORDER BY deals.deal_id DESC"
Great. however... on rare occasions a whole bunch of deals are added at once, so I need some kind of override to specify which one should be 'featured'. I added a boolean value [featured] and tested the following query:
"SELECT * FROM deals WHERE datestart < now() AND dateend > now() ORDER BY deals.featured DESC"
It worked, but now I need to specify the featured deal, or else the featured deal will be randomly selected? whereas I only want to have it as an override.
SO I need to combine the above 2 scripts somehow.
any ideas?
thanks guys.
featured = 1inWHEREclause?