List:General Discussion« Previous MessageNext Message »
From:Brian Dunning Date:November 3 2009 10:06pm
Subject:Re: Customers with no recent orders?
View as plain text  
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 table where sum(foo)=1.00

>>
>>
>> select * from customers
>> left join orders on customers.cust_id = orders.cust_id
>> where signup_date < now() - interval 14 day
>> and sum(if(order_date > now() - interval 14 day, 1, 0)) = 0
>>
>> But that gives me "Invalid use of group function".
>>
>> -- 
Thread
Customers with no recent orders?Brian Dunning3 Nov
  • Re: Customers with no recent orders?Brian Dunning3 Nov
    • RE: Customers with no recent orders?Martin Gainty3 Nov
      • Re: Customers with no recent orders?Brian Dunning3 Nov