Access: strange results with queries against MDB file

Posted by Craig Johnston on Stack Overflow See other posts from Stack Overflow or by Craig Johnston
Published on 2010-05-01T04:04:41Z Indexed on 2010/05/01 4:07 UTC
Read the original article Hit count: 291

Filed under:
|
|

I am running the following SQL against an MDB file, a copy of which is located here: http://hotfile.com/dl/40641614/2353dfc/test.mdb.html (perfectly clean file, no macros or viruses)

SELECT datediff("d", MAX(invoice.date), Now) As Date_Diff 
      , MAX(invoice.date) AS max_invoice_date 
      , customer.number AS customer_number 
FROM invoice  
    INNER JOIN customer  
        ON invoice.customer_number = customer.number 
GROUP BY customer.number

If the the following was added:

HAVING datediff("d", MAX(invoice.date), Now) > 365 

would this simply exclude rows with Date_Diff <= 365?

What should be the effect of the HAVING clause here?

© Stack Overflow or respective owner

Related posts about sql

Related posts about ms-access