Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select query (Access 2000)

    Can you give me advice ? I want to build a query showing customers that have bought in the previous years but who have not bought this year.Obiously paymentid should be 0 for 2008 but somehow I cannot build the rught query.Below is the query showing all the customers that have bought before 2008.
    But how to show the customers who have not bought this year ? I somehow cannot build it.Placing False below paymentid give me nothing relevant

    SELECT Customers.Customerid, Customers.CompanyName, orders.paymentid, orders.invoicedate
    FROM Customers LEFT JOIN orders ON Customers.Customerid = orders.customerid
    WHERE (((orders.invoicedate)<#1/1/2008#));

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Re: Select query (Access 2000)

    Try

    SELECT Customers.Customerid, Customers.CompanyName, orders.paymentid, orders.invoicedate
    FROM Customers LEFT JOIN orders ON Customers.Customerid = orders.customerid
    WHERE orders.invoicedate<#1/1/2008# AND Customers.Customerid Not In (SELECT
    customerid FROM orders WHERE invoicedate>=#1/1/2008#)

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select query (Access 2000)

    it works so great ! You are wonderful ! This query will be so useful to us, as a reminder in our actions. Thank you !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •