Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate Birthday
Message
From
21/02/2001 18:38:43
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00478188
Message ID:
00478222
Views:
27
Thank you Michael.

This code does look very elegant and I will try it out tonight. I didn't want the where clause to get too convoluted and this is very sweet.

I should have thought of it that way myself before!


>Kind of funny. This is the exact example that I'm using in my Advanced Query Techniques for SQLTeach in April.
>
>Try this query:
>
>
>SELECT
>	lastname,
>	firstname,
>	birthdate
>FROM
>	employees
>WHERE
>	DATEADD(year, DATEDIFF(year,  birthdate, GETDATE()), birthdate) BETWEEN GETDATE() AND GETDATE()+7
>	OR DATEADD(year, DATEDIFF(year,  birthdate, GETDATE()+7), birthdate) BETWEEN GETDATE() AND GETDATE()+7
>
>
>-Mike
Previous
Reply
Map
View

Click here to load this message in the networking platform