我找到了两个相似的答案
SELECT Count(*)
FROM fd_member
WHERE From_unixtime(Unix_timestamp(add_time), '%h') >= 8
AND From_unixtime(Unix_timestamp(add_time), '%h') < 12
GROUP BY CONVERT(add_time, CHAR(10))
SELECT *
FROM fd_member f
WHERE Date(f.date) >= Date('2013-10-01')
AND Date(f.date) < Date('2013-11-01')
AND Hour(f.date) >= Hour('8:00:00')
AND Hour(f.date) < Hour('12:00:00')
但他们一分钟都不准确。
答案 0 :(得分:1)
SELECT *
FROM fd_member f
WHERE Date(f.date) >= Date('2013-10-01')
AND Date(f.date) < Date('2013-11-01')
AND Time(f.date) >= Time('7:15:00')
AND Time(f.date) < Time('12:15:00')
应该有效。搏一搏。如果没有,你可以提供一个SQL小提琴,一些样本数据和你期望的