Dave: How basic it was......I cannot believe I overlooked that. Thanks for the second set of eyes. I just saw the second one working and the first not and didn't get down to the basic issue. Thanks everyone Andy
_____ From: [email protected] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 30, 2005 9:05 AM To: [email protected] Subject: Re: [ASP] DATEDIFF in Where Clause Are you sure that the date difference is right for the particular record(s) you're after? Your first select is looking for order 1042429, but your second select is looking for order 1. Also, is there a d_DateUploaded in t203? Your first select doesn't specify which table it's taking d_DateUploaded from. Dave S ----- Original Message ----- From: Mills, Andy R. (Regency) To: '[email protected]' Sent: Thursday, June 30, 2005 10:21 PM Subject: [ASP] DATEDIFF in Where Clause Hello Group: Can anyone tell me what I am doing wrong in my first SQL Statement? When I do not add the DATEDIFF in the where clause: I get the desired records. In the second Query: I have verified that when this is ran: the value for DIFF is at least a 2 (which would be greater than 1). However: I cannot seem to get the query working when using the first query. Any suggestions would be greatly appreciated. ------------------------------------------------------------------------- QUERY #1 ------------------------------------------------------------------------- SELECT i_ID, s_UniqueName FROM tPGOrderFiles P INNER JOIN t203 I ON I.Ohornm = P.i_OrderID WHERE P.i_OrderID = 1042429 AND I.Ohstat NOT IN ('S', 'V') AND DATEDIFF(DAY, d_DateUploaded, GETDATE()) > 1 ------------------------------------------------------------------------- QUERY #2 ------------------------------------------------------------------------- SELECT DATEDIFF(DAY, d_DateUploaded, GETDATE()) AS Diff FROM tPGOrderFiles WHERE i_OrderID = 1 Thanks Andy Mills Programmer Regency Thermographers 717-765-3572 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] http://www.regencythermo.com <http://www.regencythermo.com> <http://www.regencythermo.com/ <http://www.regencythermo.com/> > [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages <http://groups.yahoo.com/group/active-server-pages> --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- ---------------------------------------------------------------------------- -- YAHOO! GROUPS LINKS a.. Visit your group "active-server-pages" on the web. b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. ---------------------------------------------------------------------------- -- [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages <http://groups.yahoo.com/group/active-server-pages> --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- _____ YAHOO! GROUPS LINKS * Visit your group "active-server-pages <http://groups.yahoo.com/group/active-server-pages> " on the web. * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . _____ [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
