My table has multiple entries by individual customers, These customers have made multiple purchases over the years from any of several
suppliers listed in my database. I need to run a query to select those whose most recent purchase was from supplier 'A'. If a customer purchased from
supplier 'A' last month, but their most recent purchase was, say, yesterday from
supplier 'B', then I don't want them included in the result. This may be a simple query, but I'm having trouble getting my head around a reliable method of running this query.
Basically, what I'm looking to generate is:
SELECT `customer_email`, `supplier`, `purchase_date` from `customer_table` WHERE `supplier` = 'A' and
... "this purchase by "customer_email" is "customer_email's" most recent purchase, even though they have made multiple previous purchases from any of several 'suppliers'.
Any help in pointing me in the right direction as to completing this query would be greatly appreciated!