0

以下是查询

SELECT
users.userName,
rechannel.channelName,
trschedule.ContentType,
trprogram.programName,
trschedule.Description,
trschedule.startTime,
trschedule.endTime,
TIMEDIFF(trschedule.startTime,trschedule.endTime) AS Difference,
LENGTH(trschedule.Description) AS Charcter_Count,
ROUND( LENGTH(trschedule.Description)/6) AS Word_Count,
ROUND( LENGTH(trschedule.Description)/65) AS Line_Count,
trschedule.ProvinceName,
trschedule.CityName,
trschedule.AreaName,
trschedule.ContentTone,
trschedule.searchText,
trschedule.CountryName,
trschedule.transmissionDate,
trschedule.insDate
FROM users 
Inner Join trschedule ON users.userID = trschedule.insertID 
Inner Join rechannel ON rechannel.channelID = trschedule.channelID 
Inner Join trprogram ON trprogram.programID = trschedule.programID
WHERE (trschedule.insDate BETWEEN '2012-10-01' AND '2012-10-12')

但结果显示从 (insertDate)2012-10-01 到 2012-10-11 没有显示 2012-10-12 的数据。

任何想法的原因是什么???/

4

3 回答 3

1

我认为这应该可行,只需更改最后一行:

WHERE (DATE(trschedule.insDate) BETWEEN '2012-10-01' AND '2012-10-12')
于 2012-10-12T12:50:00.550 回答
1

由于您没有指定日期的时间部分,mySQL 将“2012-10-12”视为“2012-10-11”和“2012-10-12”之间的午夜。

尝试将之间替换为:

trschedule.insDate >= '2012-10-01' AND trschedule.insDate < '2012-10-13'

于 2012-10-12T12:50:27.563 回答
1

或者试试这个:

WHERE (trschedule.insDate BETWEEN '2012-10-01 00:00:00' AND '2012-10-12 23:59:59')
于 2012-10-12T12:58:22.683 回答