Re: need some SQL help

From: howzat <dave_at_dave.net>
Date: Thu, 29 Dec 2005 17:02:12 GMT
Message-ID: <oEUsf.15198$5v1.2483_at_newsfe2-win.ntli.net>


"Hugo Kornelis" <hugo_at_pe_NO_rFact.in_SPAM_fo> wrote in message >

> SELECT customer_id
> FROM (SELECT customer_id, order_type
> FROM orders
> WHERE order_type IN (3, 4)
> GROUP BY customer_id, order_type
> HAVING ( order_type = 3 AND SUM(amount) > 100)
> OR ( order_type = 4 AND SUM(amount) > 200) ) AS derived
> GROUP BY customer_id
> HAVING COUNT(*) = 2
>

hugo, do you know how I'd modify your query to return only a count of the matching rows? I've tried various changes but I'm really just clutching at straws. Received on Thu Dec 29 2005 - 18:02:12 CET

Original text of this message