Try using WHERE & see.SELECT customer_name,color, sum(qty) AS qty FROM customer WHERE color='red' GROUP BY customer_name
by the way i wonder how you got this statement working. How you managed to include color in SELECT list? I believe it should be written like thisSELECT c.customer_name,c.color,t.qty FROM customer cINNER JOIN (SELECT customer_name,sum(qty) AS qty FROM customer GROUP BY customer_name )tON t.customer_name=c.customer_nameWHERE c.color='red'
i think difference between HAVING & WHERE is that HAVING clause will apply filteration only after performing grouping of data while WHERE clause does filteration before grouping. see this article[url]http://www.devx.com/DevX/Tip/21295 [/url]