Q:

Mysql query time to show result with default date time value

I have part of my mysql query as below 
Select sNumber  From serial Where  
TIME_TO_SEC( TIMEDIFF(  '2014-12-03 14:19:11', lastEventTime ) ) >=300

It works fine to generate a result if the time diff is in comparison to the lastEvenTime is more than 300 seconds. My issue now is that if the lastEventTime is the default value "0000-00-00 00:00:00" then it sends me as empty result. How to ensure that if its default value then I would like to show too as result?

A:

Try this:
Select sNumber  From serial Where  
TIME_TO_SEC(IF(lastEventTime='0000-00-00 00:00:00',300,
TIMEDIFF('2014-12-03 14:19:11', lastEventTime)) ) >=300

Please let me know if it helps you.
EDIT
If you change your field to null, try this:
Select sNumber  From serial Where  
TIME_TO_SEC(IF(lastEventTime IS NULL,300,
TIMEDIFF('2014-12-03 14:19:11', lastEventTime)) ) >=300

EDIT 2
Try this one instead:
Select sNumber  From serial Where  
IF(lastEventTime IS NULL,300,
TIME_TO_SEC(TIMEDIFF('2014-12-03 14:19:11', lastEventTime))) >=300

