我创建了以下存储过程,用于计算所选位置的特定范围之间每天的记录数:
[dbo].[getRecordsCount]
@LOCATION as INT,
@BEGIN as datetime,
@END as datetime
SELECT
ISNULL(COUNT(*), 0) AS counted_leads,
CONVERT(VARCHAR, DATEADD(dd, 0, DATEDIFF(dd, 0, Time_Stamp)), 3) as TIME_STAMP
FROM HL_Logs
WHERE Time_Stamp between @BEGIN and @END and ID_Location = @LOCATION
GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, Time_Stamp))
但问题是结果没有显示记录为零的日子,我很确定这与我的 WHERE 语句不允许显示零值有关,但我不知道如何解决这个问题.
提前感谢尼尔