I am in need of your help as I am struggling with a query in SQL. This query is not giving exact result that I want. I need to pull out all the dates between two dates.
I tried two queries:
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')
and
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')
This gives results with the date '02/05/1990', '02/17/1990' also. It considers only month and date, not the year exactly.