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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date filter

Author  Topic 

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-02-07 : 06:25:49
Hi guys can you give a query where I can get my data filtered by date..

(a.jetTransactionDate between 01 / 01 / 01 / 2007 AND CONVERT(DATETIME, '2007-01-30 00:00:00', 102))

but I can't get the data for January instead all transactions for the past years have been included

thanks!

:)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-07 : 06:38:08
a.jetTransactionDate >= '1 Jan 2007' AND a.jetTransactionDate<='31 Jan 2007'

i assume jetTransactionDate field is of datetime datatype
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-02-07 : 06:48:06

this is the sample data in jetTransactionDate field
3/8/2006 11:19:12 AM
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-02-07 : 06:48:48
okay thanks! :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-07 : 07:08:57
Better usage

jetTransactionDate >='20070101' and jetTransactionDate <'20070201'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-02-07 : 07:43:58
May I know the the shortcut for the months of February to December"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-02-07 : 08:17:13
quote:
Originally posted by eem_2055

May I know the the shortcut for the months of February to December"


month not in ('January')???

What do you mean?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

eem_2055
Yak Posting Veteran

69 Posts

Posted - 2008-02-07 : 08:41:36
thanks:)Madhivanan and visakh16 thanks a lot!
Go to Top of Page
   

- Advertisement -