Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculate Birthday
Message
De
21/02/2001 18:38:43
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
À
21/02/2001 17:43:41
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00478188
Message ID:
00478222
Vues:
28
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform