Customers with no recent orders?

2009-11-03 Thread Brian Dunning
I thought I could find the answer to this by googling, but had no luck. How do I show a list of customers who: (a) Have placed no orders within 14 days, (b) Have been a customer for at least 14 days. (They do not have to have placed any orders, ever, to be a customer.) I'm trying to show

Re: Customers with no recent orders?

2009-11-03 Thread Brian Dunning
More info. If the tables look like this: customers -- cust_id signup_date orders -- order_id cust_id order_date Then the SQL needs to accomplish something like this: select * from customers left join orders on customers.cust_id = orders.cust_id where

RE: Customers with no recent orders?

2009-11-03 Thread Martin Gainty
. Subject: Re: Customers with no recent orders? From: br...@briandunning.com Date: Tue, 3 Nov 2009 12:54:31 -0800 To: mysql@lists.mysql.com More info. If the tables look like this: customers -- cust_id signup_date orders -- order_id cust_id

Re: Customers with no recent orders?

2009-11-03 Thread Brian Dunning
Thanks. I added orders.order_date to the list of fields being selected, but it still returns invalid use of group function. On Nov 3, 2009, at 1:09 PM, Martin Gainty wrote: any column used in any group functions such as SUM needs to be requested in select column e.g. select foo from