Nov 15, 2011
I have a table with following data Fields:
View 1 Replies
OID, Product, Condition, QTY DATA:
1, Product A, NEW, 60
2, Product A, B, 60
3, Product A, C, 40
4, Product B, NEW, 30
5, Product B, C, 20
I want to write my procedure so that when I execute it, it will return a table as such.
Product Name, NEW, B, C
Product A, 60, 60, 40
Product B, 30, 0, 20 SELECT PRODUCT,(CASE WHEN CONDITION LIKE 'NEW' THEN QTY END) AS NEW, (CASE WHEN CONDITION LIKE 'B' THEN QTY END) AS B, (CASE WHEN CONDITION LIKE 'C' THEN QTY END) AS C
I got to the point where it will show different quantities in corresponding column but I was unable to merge them into single row.