HighDots Forums  

SQL Date question

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss SQL Date question in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Zwi2000
 
Posts: n/a

Default SQL Date question - 07-03-2004 , 09:54 PM






Hi,

I have the follwing sql, the problem is that I am trying to bring up all
records which date is equal to getdate().

The problem seems to be that the "date" which is a timedate field compares
getdate and the time too, do I dont get any matches. How can I compare the
dates only ?

SQL:

Select

a.Id, a.CaseId, a.AlienId, b.UserId, b.FirstNm,
b.LastNm,a.Process,a.Processstep,c.ProcesscatalogI d,c.Processcatalog,d.Proce
ssstepId,d.Processtep, d.TimeFrame, d.EmailAlert, a.Processdateupdate,
DATEADD(day,d.Timeframe , a.Processdateupdate ) AS Datedue

from cases as a
LEFT JOIN Users b ON a.AlienID = b.UserID
INNER JOIN Processcatalog c ON a.Process = c.ProcesscatalogID
INNER JOIN Processstep d ON a.Processstep = d.ProcessstepId
INNER JOIN atts e on a.id = e.caseid

WHERE a.Firmid = 2 AND (DATEADD(day,d.Timeframe,a.Processdateupdate ) =
getdate())


Help Appreciated,

Z



Reply With Quote
  #2  
Old   
Julian Roberts
 
Posts: n/a

Default Re: SQL Date question - 07-04-2004 , 07:03 AM






Use datediff. eg

select * from t where datediff(d,datefield,getdate())=0

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004



Reply With Quote
  #3  
Old   
Zwi2000
 
Posts: n/a

Default Re: SQL Date question - 07-04-2004 , 09:57 AM



Excelent, this worked:

datediff(d,(DATEADD(day,d.Timeframe,a.Processdateu pdate)),getdate())=0

Thanks !!!

Z



"Julian Roberts" <newsg (AT) charon (DOT) co.uk> wrote

Quote:
Use datediff. eg

select * from t where datediff(d,datefield,getdate())=0

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.