我正在尝试编写如下例所示的 sql 查询,但是,我需要它始终在当天的上午 8:00 日期和下午 4:00 的当天日期之间选择 DateEntered 字段。不知道该怎么做。有人可以帮忙吗?
SELECT OrderNumber
, OrderRelease
, HeatNumber
, HeatSuffix
, Operation
, COUNT(Operation) AS [Pieces Out of Tolerance]
FROM Alerts
WHERE (Mill = 3)
AND (DateEntered BETWEEN GetDate '08:00' AND GetDate '16:00')
GROUP BY OrderNumber, OrderRelease, HeatNumber, HeatSuffix, Operation