Need SQL help to fetch data, with some tricky conditions
September 3, 2007 11:06 PM Subscribe
From two MySQL tables, I need to fetch a list of customers who DOES NOT have an invoice issued to them within the past 2 months. More details about the table structures inside.
posted by arrowhead to Computers & Internet (10 answers total) 2 users marked this as a favorite
Here's the general structure - 2 MySQL tables, "customer" and "invoice". Table "customer" contains customer_id, customer_name. Table "invoice" has invoice_id, invoice_date, invoice_amount and customer_id.
My task - to create a report via PHP, and I need to get all customers who DOES NOT have an invoice issued to them within the last 2 months.
I can't figure out the simplest, most efficient SQL to do this.