1

I am trying to return all the records on a certain date and less than an exact time
my SQL looks like this

  • WHERE date = '2014-08-28'
  • and UNIX_TIMESTAMP(time) < '14:48:22'
    This returns all the time records and doesn't cutoff the time at the specified point

  • WHERE date = '2014-08-28'
  • and time < '14:48:22'
    This query cuts off the time at '14:28:22' but also cuts off all time before '10:00:00'

I have also tried the cast() but no luck

4

2 回答 2

0

你可以试试这个:

WHERE date = '2014-08-28' and time < time('14:48:22')

看起来没有比较time()是用数字而不是时间来完成的。

于 2014-12-15T15:10:27.040 回答
-1
SELECT COUNT(0) FROM oc_marchenthoursofoperations 
WHERE dayes = DAYNAME(NOW()) AND TIME(CURRENT_TIME()) BETWEEN TIME( CONVERT(`fromtime`,TIME)) 
AND TIME(CONVERT(`totime`,TIME))  AND `marchentid`='MTN-MAR-00052';
于 2016-10-03T11:06:47.993 回答