SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Date Query Criteria
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ruci1225
Starting Member

USA
3 Posts

Posted - 04/26/2013 :  13:41:59  Show Profile  Reply with Quote
In the database I have two date fields I am interested in
Lead Date
Record As od Date

In this scenerio I am trying to get all leads with lead date of x and return the line item where recordasofdate = Lead Date >= 14 and < 15 days.

this will allow me to see the status of the lead 14 days later for all the leads.


Lamprey
Flowing Fount of Yak Knowledge

4613 Posts

Posted - 04/26/2013 :  13:54:04  Show Profile  Reply with Quote
What does this mean? "recordasofdate = Lead Date >= 14 and < 15 days"

It really helps if you can post sample data in a consumable format along with expected results. It makes it so we can run queries against your data and you get tested queries. Please see the links below:

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 04/29/2013 :  00:35:49  Show Profile  Reply with Quote
asuuming its a typo and you meant date difference you can do like

...
WHERE recordasofdate > = DATEADD(dd,DATEDIFF(dd,0,LeadDate),14)
AND  recordasofdate  < DATEADD(dd,DATEDIFF(dd,0,LeadDate),15)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000