Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group By Having Problems
Message
 
 
À
22/03/2005 10:52:28
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00998084
Message ID:
00998122
Vues:
18
>Thanks for posting that Sergery, I was actually trying to find out how to do that the other week. :)

You're welcome. You can also use the same technique to calculate begining of other periods by substituting 'day' part with other part. For example,
DECLARE @dt datetime
SET @dt = GETDATE()

-- begining of the month date
SELECT DATEADD(mm, DATEDIFF(mm, 0, @dt), 0)
-- begining of the year date
SELECT DATEADD(year, DATEDIFF(year, 0, @dt), 0)
-- e.t.c
BTW, this and some other tips and tricks has been published in 2004 issues of UT magazine.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform