MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Patrick Shoaf Date:September 18 2003 11:47am
Subject:Need help writing query
View as plain text  
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.



Patrick J. Shoaf, Systems Engineer
<mailto:pshoaf@stripped>pshoaf@stripped

Midmon Internet Services, LLC
100 Third Street
Charleroi, PA 15022
http://www.midmon.com
Phone: 724-483-2400 ext. 105
  or    888-638-6963
Fax:   724-489-4386


Thread
Need help writing queryPatrick Shoaf18 Sep
  • Re: Need help writing queryEgor Egorov18 Sep
    • Re: Need help writing queryPatrick Shoaf18 Sep