hi my problem is to show all colors of product in single column, in single row below is the query , its show multiple row from sub query error , i want all result of color will come in single column seprated by comma for example if a product has 3 to 5 color in attributesvalue table than a single column "color" with single row comes and show Red,green, blue as values in color column select p.productName, ( select categoryName from category c where c.id=p.id) as categoryName, ( select av.valueName from attributesvalue av,modelattributes ma where ma.attributevalueid=av.valueid and ma.productid =p.productid) as color, from product p ORDER BY p.productName
you can use group_concat here... it is good to collect data in one element only in comma separated manner. example: select p.productName, ( select categoryName from category c where c.id=p.id) as categoryName, group_concat(( select av.valueName from attributesvalue av,modelattributes ma where ma.attributevalueid=av.valueid and ma.productid =p.productid)) as color, from product p GROUP BY p.productName ORDER BY p.productName