select initial_time, closing_date, length_of_duration(in minutes) from table1;
initial_time is in date time stamp (ex:2011-02-14 20:35:00)
closing_date is in date (for ex:2011-02-14)
length_of_duration in minutes (5)
我希望得到0或1(即真或假):
对于true:
Current time stamp is greater than (initial_time + length_of_duration less than closing_date);
例如:If current time stamp is 2011-02-14 21:35:00 & initial_time -2011-02-14 20:35:00, length-5 mins and closing date is 2011-02-14, since current time is greater than these, it should return true.
根据mysql中的select查询获取此输出的任何想法?感谢。
答案 0 :(得分:0)
if (date_add(initial_time , interval length_of_duration minute)
<=concat(closing_date, ' 23:59:59'), 1, 0)
假设截止日期在2011-02-15之前,使用23:59:59
的原因,
这是2011-02-14 23:59:59