You are not logged in.

#1 2010-02-02 17:58:36

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

MYSQL query help..... [SOLVED -- myself -- two min later]

Ok, I've got a table like this:

style     color     size
145       red       s
145       red       m
145       red       l
145       blue      s
145       blue      m
150       red       s
150       red       m

etc etc....there is also a sku field as primary key for each item.

I'm sure it's simple, but how the heck can I get a list of style and color without the size?

Like:

style    color
145      red
145      blue
150      red

Thanks,
Scott

Edit: answer:  select distinct color,style from table;
I thought at first that would only give me the distinct colors for the whole table, not for each style. Ah well

Last edited by firecat53 (2010-02-02 18:06:14)

Offline

#2 2010-02-02 18:02:52

noreaga
Member
From: Bulgaria
Registered: 2010-02-01
Posts: 20

Re: MYSQL query help..... [SOLVED -- myself -- two min later]

You can try

 select style, color from tablename

where tablename is the name of the table where is your data.

Last edited by noreaga (2010-02-02 18:05:07)

Offline

#3 2010-02-02 18:07:12

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: MYSQL query help..... [SOLVED -- myself -- two min later]

@noreaga -- that would give you the style and color for each size as well. smile Anyways, solved. Thanks!

Offline

Board footer

Powered by FluxBB