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/> 





  [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 

    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
---------------------------------------------------------------------
 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/
 


Reply via email to