I have written the following code its working properly but I have to add a third case in it for year=2012.
SELECT P.PRODUCT_NAME,s.PRODUCT_ID
FROM products P
JOIN SALES S
ON P.Product_ID = S.PRODUCT_ID
GROUP BY p.PRODUCT_NAME,S.PRODUCT_ID
having (sum(case when s.year = 2011 then s.quantity else 0 end) >
sum(case when s.year = 2010 then s.quantity else 0 end)
);
hope so everyone can understand my problem.
i have found its answer: