在您看来,除了我指定的日期范围外,我该如何帮助您解决问题?
未列出7月1日至7月12日之间的时间
https://i.hizliresim.com/od7YzX.jpg
SELECT DISTINCT
s.A, CONVERT(varchar, d.timein, 104) AS G
FROM DATABASE.table1 AS a INNER JOIN
DATABASE.table2 AS b ON a.x = b.y INNER JOIN
DATABASE.dbo.table3 AS c ON b.b = c.d INNER JOIN
DATABASE.dbo.table4 AS e ON c.f = e.r INNER JOIN
DATABASE.table5 AS d ON e.t = d.u INNER JOIN
DATABASE.table6 AS s ON a.fr = s.rf INNER JOIN
DATABASE.table7 AS si ON d.er = si.pr INNER JOIN
DATABASE.table8 AS i ON si.dd = i.gt INNER JOIN
DATABASE.table9 AS ck ON s.mkk = ck.pxx
WHERE (CONVERT(varchar, d.timein, 104) BETWEEN '01.07.2019' AND '12.07.2019')
答案 0 :(得分:1)
尝试使用日期格式为'yyyy-MM-dd'
BETWEEN '2019-07-01' AND '2019-07-12'
答案 1 :(得分:0)
不比较字符串日期,不比较日期。
WHERE d.timein BETWEEN '2019-07-01' AND '2019-07-12'
请注意,这将返回介于2019-07-01 00:00:00
和2019-07-12 00:00:00
之间的日期,因此您可能需要使用2019-07-13
或2019-07-12 23:59:59
比较字符串时,它会从左到右比较字符,因此,10.12.2018
在01.07.2019
和12.07.2019
之间,因为10
在{{ 1}}和01