我需要您的帮助,因为我正在努力处理 SQL 中的查询。这个查询没有给出我想要的确切结果。我需要提取两个日期之间的所有日期。
我尝试了两个查询:
SELECT a.MemberID,CONVERT(varchar(12), b.BirthDate, 101) AS BirthDate
FROM Members_Hired AS a
INNER JOIN Members AS b
ON a.ReferenceID = b.RecordID
WHERE (CONVERT(varchar(12), b.BirthDate, 101) >= '02/01/2013'
and CONVERT(varchar(12), b.BirthDate, 101) <= '02/27/2013')
和
SELECT a.MemberID,CONVERT(varchar(12), b.BirthDate, 101) AS BirthDate
FROM Members_Hired AS a
INNER JOIN Members AS b
ON a.ReferenceID = b.RecordID
WHERE (CONVERT(varchar(12), b.BirthDate, 101) BETWEEN '02/01/2013' and '02/27/2013')
这也给出了 date 的'02/05/1990'
结果'02/17/1990'
。它只考虑月份和日期,而不是确切的年份。