Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Starting Member

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.

Flowing Fount of Yak Knowledge

4614 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:
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 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
Go to Top of Page
  Previous Topic Topic Next 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.05 seconds. Powered By: Snitz Forums 2000