Are you looking for something like this?
DECLARE @table1 TABLE
(
id INT IDENTITY(1,1),
DateOfBirth DATETIME
)
INSERT INTO @table1
SELECT '20060331' UNION ALL
SELECT '20060401' UNION ALL
SELECT '20060402' UNION ALL
SELECT '20090331' UNION ALL
SELECT '20090401' UNION ALL
SELECT '20090402'
DECLARE @curDate DATETIME
SET @curDate = DATEADD(dd,DATEDIFF(dd,0,GETDATE()),0)
Select *
FROM @table1
WHERE DateOfBirth > DATEADD(yy,-6, @curDate)
AND DateOfBirth <= DATEADD(yy,-3, @curDate)
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question[/url]
How to post performance related questions[/url]
Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]