X-Received: by 10.224.207.2 with SMTP id fw2mr5094250qab.6.1366210208944; Wed, 17 Apr 2013 07:50:08 -0700 (PDT) X-Received: by 10.182.190.4 with SMTP id gm4mr224019obc.36.1366210208856; Wed, 17 Apr 2013 07:50:08 -0700 (PDT) Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!ca1no546265qab.0!news-out.google.com!ef9ni24qab.0!nntp.google.com!ca1no546255qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.databases.ms-sqlserver Date: Wed, 17 Apr 2013 07:50:08 -0700 (PDT) In-Reply-To: <03f8c0f4-4009-4762-8337-aeb7d15a926a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=195.57.19.2; posting-account=jIl9nQoAAAA9P37IIqQq64yAx-2NQYiu NNTP-Posting-Host: 195.57.19.2 References: <03f8c0f4-4009-4762-8337-aeb7d15a926a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0fa01ee9-58f2-4d47-b9eb-78212b694d8b@googlegroups.com> Subject: Re: SQL Date expressions From: bradbury9 Injection-Date: Wed, 17 Apr 2013 14:50:08 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 1628 Xref: csiph.com comp.databases.ms-sqlserver:1449 El mi=E9rcoles, 17 de abril de 2013 16:17:20 UTC+2, contracer escribi=F3: > Hi,=20 >=20 >=20 >=20 > How could I create these sql expressions ? >=20 >=20 >=20 > last 7 days >=20 > last 30 days >=20 > last month >=20 > last week >=20 > this year >=20 > last year >=20 >=20 >=20 > Thanks Using TSQL date functions, here is a list: http://msdn.microsoft.com/en-us/library/ms186724.aspx Most usual functions are GetDate(), DatePart() and DateAdd()