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
 DateDiff > 30 days

Author  Topic 

Damian39
Starting Member

33 Posts

Posted - 2015-02-03 : 09:30:52
Hello all,
I'm trying to use the DateDiff function within my select statement, but I'd like to add the parameter of greater than 30 days. This will have the query only return records where my bill stop date is greater than 30 days from the completion date. I currently have the datediff function within my select statement as


DATEDIFF (d,A.StopBillDate, a.CompletionDate) as [DIFFERENCE]


I would prefer to keep the datediff function within the select statement so as to have difference in days appear as a column within my output. Unfortunately, I have been unable to add the parameter of > 30 days to the query without getting an error. I was hoping someone has come across this before and possibly might have a solution they would be willing to share. Thank you all for taking the time to read this!



Damian

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-03 : 09:47:56
post the entire query (beginning with SELECT and ending with a semicolon;) and the error message.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2015-02-03 : 09:49:26
where DATEDIFF (d,A.StopBillDate, a.CompletionDate) > 30


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -