Access 2007 - Building unmatched data query, but need two field categories
Is it possible to build an unmatched data query using two tables with a tracking a unique value field and also another v开发者_C百科alue in the row as well (that value will not be unique).
For example I want to track a unique customer code from an invoice on a new table, compared to last month's invoice. The non unique value would be a "product code" of what they purchased.
A customer code could appear multiple times depending on if they have purchased multiple product codes.
Any help is much appreciated.
This should do what you want:
SELECT Invoice.CustomerID
FROM Invoice LEFT JOIN PreviousInvoices
ON (Invoice.Product = PreviousInvoices.Product)
AND (Invoice.CustomerID = PreviousInvoices.CustomerID)
WHERE PreviousInvoices.Product Is Null
精彩评论