liomon41 Posted June 18, 2012 Share Posted June 18, 2012 Can anyone please explain to me in details(if possible) what this query does.. $query = "SELECT firstTeam, secondTeam, gameId, date, time, IF(SUBTIME(TIMESTAMP(`date`, `time`), '1:0:0') > NOW(), 1, 0) as active FROM fixtures ORDER BY date, time"; having issues with "as active" , never used that before, need your help... thanks Quote Link to comment Share on other sites More sharing options...
smoseley Posted June 18, 2012 Share Posted June 18, 2012 "active" means the game hasn't started yet, and won't start within the next hour. Quote Link to comment Share on other sites More sharing options...
liomon41 Posted June 19, 2012 Author Share Posted June 19, 2012 okay ... what about this part of the query ... IF(SUBTIME(TIMESTAMP(`date`, `time`), '1:0:0') > NOW(), 1, 0) Quote Link to comment Share on other sites More sharing options...
smoseley Posted June 19, 2012 Share Posted June 19, 2012 It's exactly what I just said. That means "if date & time of the game is more than one hour in the future, return 1... otherwise return 0..." and that formula is aliased "AS" the pseudo-column "active". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.