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)
 Show records where the date is more then 30 days ago

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-10-26 : 07:59:45
Joseph H. LeBlanc writes "This is the string and I can not figure out what I am missing.

strSQL= "SELECT tblservices.*, tblcontacts.* FROM tblservices INNER JOIN tblcontacts ON tblservices.fldcontact=tblcontacts.fldcontact WHERE tblservices.flddate<=tblservices.flddate+30 AND tblservices.fldcompleted='Yes' AND tblservices.fldbillable='Yes' AND tblservices.fldinvoiced='Yes' AND tblservices.fldcalled='No'""

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-10-26 : 08:14:43
[code]
strSQL= "SELECT tblservices.*, tblcontacts.* FROM tblservices INNER JOIN
tblcontacts ON tblservices.fldcontact=tblcontacts.fldcontact WHERE
tblservices.flddate<=dateadd(dd,30,tblservices.flddate) AND
tblservices.fldcompleted='Yes' AND tblservices.fldbillable='Yes' AND
tblservices.fldinvoiced='Yes' AND tblservices.fldcalled='No'""

[/code]

Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-26 : 08:15:18
quote:
Originally posted by AskSQLTeam

Joseph H. LeBlanc writes "This is the string and I can not figure out what I am missing.

strSQL= "SELECT tblservices.*, tblcontacts.* FROM tblservices INNER JOIN tblcontacts ON tblservices.fldcontact=tblcontacts.fldcontact WHERE tblservices.flddate<=tblservices.flddate+30 AND tblservices.fldcompleted='Yes' AND tblservices.fldbillable='Yes' AND tblservices.fldinvoiced='Yes' AND tblservices.fldcalled='No'""


It would help if you could describe the problem you are having or what you need help with.




CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-26 : 08:17:12
What is this?
WHERE tblservices.flddate<=tblservices.flddate+30


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

samuelclay
Yak Posting Veteran

71 Posts

Posted - 2006-10-26 : 12:52:20
lol... something is always less than something + 30 isnt it?

wouldn't something like:

WHERE tblservices.flddate<=dateadd(dd,-30,getdate())

work a little better?

(or a datediff > 30... or .... but flddate compared to current date)
Go to Top of Page
   

- Advertisement -