Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
My brain isn't working right now due to a lot of stress. Could someone help me rewrite this bit so that it can use an index?WHERE DATEDIFF(dd, q.CREATION_TIME, i.CREATION_TIME) > 3I just need to isolate q.CREATION_TIME to the left side of the WHERE clause. The table associated with the "i" alias will only contain one row, so I don't care about an index there. WHERE q.CREATION_TIME ...Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
sodeep
Master Smack Fu Yak Hacker
7174 Posts
Posted - 2009-02-09 : 20:28:23
Looks like you are working too much Try this:
WHERE q.CREATION_TIME < DATEADD(dd,-3,i.CREATION_TIME)