Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I have a tutorial in which there is a question to find the person who will be celebrating their Birthday within a week.The table contains : name, dob, sexThanksKnowledge grows when shared...
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2006-08-11 : 07:07:18
Do you have a question?CODO ERGO SUM
crazyme
Starting Member
11 Posts
Posted - 2006-08-11 : 07:21:27
The question is..."Who are the person who will be celebrating their Birthday within a week?"Hope i'm clear now.Knowledge grows when shared...
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts
Posted - 2006-08-11 : 07:28:33
Something like this...
Select * from Table x, (select name, dateadd(yyyy, datediff(yyyy, dob,getdate()), dob) as CurrDate from Table) ywhere x.name = y.name and datediff(wk, y.CurrentDate, y.CurrentDate+7) = 1