selecting current match from the cricket schedule using mysql query -
i have cricket schedule , need select matches of current day half hour before match starts , selection should last until 2 hours past end of match , should done in single query have used following query not working accurately...
select * `schedule` date1 between date_sub(now(), interval 30 minute) , date_add(now(), interval 10 hour)
if want display scheduled matches half hour before start until 2 hours after end, , mathces have duration of 12 hours, need show matches within 14,5 hours interval, , not 10,5 hours interval current code does:
select * `schedule` now() between date_sub(date1, interval 30 minute) , date_add(date1, interval 14 hour)
furthermore, should compare current time (now()
) start time , end time of game, not other way round.
Comments
Post a Comment