Showing posts with label fileclose. Show all posts
Showing posts with label fileclose. Show all posts

Sunday, March 11, 2012

cal number of days in between dates

select a.RelocateID,a.DateEntered,a.CompanyID,b.FileClose dDate from test1 a inner join test b on
(a.RelocateID = b.RelocateID) where
CompanyID ='5710' and DateEntered >= '01/01/2004' and convert(varchar,FileClosedDate,101) < '31/12/2004'

Hi I was wondering if somebody could help me alter this query so I an calulate the difference in days in between DateEntered and FileClosedDate having the above criteria.
I can't seem to be able to get the datediff function right in this particular examplewhy are you converting FileClosedDate to varchar?

let the database compare dates as dates ;) :)

what are the datatypes of the two date columns?|||Try using # Sign before and After Dates like
select a.RelocateID,a.DateEntered,a.CompanyID,b.FileClose dDate from test1 a inner join test b on
(a.RelocateID = b.RelocateID) where
CompanyID ='5710' and DateEntered >= #01/01/2004# and convert(varchar,FileClosedDate,101) < #31/12/2004#|||Try using # Sign before and After Dates like
select a.RelocateID,a.DateEntered,a.CompanyID,b.FileClose dDate from test1 a inner join test b on
(a.RelocateID = b.RelocateID) where
CompanyID ='5710' and DateEntered >= #01/01/2004# and convert(varchar,FileClosedDate,101) < #31/12/2004#

This is the SQL Server forum, not the MS Access forum, darvesh...