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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Date Comparison

Author  Topic 

ladiaocb
Yak Posting Veteran

57 Posts

Posted - 2005-03-21 : 13:30:50
Need Help,

I have a table that looks like:

ID DateRecevied DateClosed
1 2003-02-04 00:00:00.000 2003-03-25 00:00:00.000
2 2003-02-07 00:00:00.000 2003-02-19 00:00:00.000
3 2003-02-10 00:00:00.000 2003-02-14 00:00:00.000

I want to return all rows where it took 10 and more days to close from the time it was received. Thanks in advance!!


spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-21 : 13:46:16
select ID, DateRecevied, DateClosed
from MyTable
where datediff(d, DateRecevied, DateClosed) >= 10

Go with the flow & have fun! Else fight the flow
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-03-21 : 13:59:14
For performance reasons:

select ID, DateRecevied, DateClosed
from MyTable
where DateClosed >= DATEADD(d, 10, DateRecevied)

Tara
Go to Top of Page

ladiaocb
Yak Posting Veteran

57 Posts

Posted - 2005-03-21 : 14:18:45
Thanks much!!!
Go to Top of Page
   

- Advertisement -