Patrick Shoaf <[EMAIL PROTECTED]> wrote: > I have a table name product defined as follows: > Item_Code > Item_Size > Item_Color > Item_img > Description > Cost > Retail_Price > Category > and other non-essential items, such as qty based on code,size,&color > > The data is as follows: > j2400 S BLK j2400blk.jpg Black Jacket 12.00 24.00 Jacket > j2400 M BLK j2400blk.jpg Black Jacket 12.00 24.00 Jacket > j2400 L BLK j2400blk.jpg Black Jacket 12.00 24.00 Jacket > j2400 4XL BLK j2400blk.jpg Black Jacket 18.00 36.00 Jacket > p2400 S BLK p2400blk.jpg Black Pants 16.00 32.00 Pants > p2400 M BLK p2400blk.jpg Black Pants 16.00 32.00 Pants > p2400 L BLK p2400blk.jpg Black Pants 16.00 32.00 Pants > p2400 4XL BLK p2400blk.jpg Black Pants 24.00 48.00 Pants > > I need the result to show: > j2400 S,M,L,4XL BLK j2400blk.jpg Black Jacket 12,12,12,18 > p2400 S,M,L,4XL BLK p2400blk.jpg Black Pants 16,16,16,24 > > How would you write this query? > I used initially > > SELECT Item_Code,Item_Size,Item_Color,Item_Img,Description,Cost FROM product > WHERE Category="Jacket" or Category="Pants" GROUP BY Item_code > > This resulted in only retrieving the first item in the list for size & > price info. >
There is a GROUP_CONCAT() function, that is available from version 4.1: http://www.mysql.com/doc/en/GROUP-BY-Functions.html -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]