Welcome to WebmasterWorld Guest from 54.159.250.110

Forum Moderators: open

Message Too Old, No Replies

Help with MS SQL query

   
7:15 pm on Jun 9, 2010 (gmt 0)

5+ Year Member



I'm a bit stumped and hope someone can help. I have this table:


CAT STY COL SIZ
---------------
NEW F21 RED SML
NEW F21 RED LRG
NEW F21 BLK SML
NEW F21 BLK LRG
NEW F44 RED SML
NEW F44 RED LRG
NEW F44 GRN SML


On a previous page the CAT has already been picked...what I want to show on a page (assuming CAT=NEW):

CAT=NEW, STY=F21, COL=RED, BLK
CAT=NEW, STY=F44, COL=RED, GRN


Size does not need to display on this page but lines are differentiated by their size, as shown in the table example.

So basically given the cat, for each distinct style I want to show all available colors.

how do I construct a query that does this?

Thanks for any help you can offer!
Chris
8:59 pm on Jun 9, 2010 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Unless I'm misreading something, the following should work:
SELECT DISTINCT STY, COL
FROM table
WHERE Cat='NEW'

How you output that depends on the language you're using for your front end development.
12:10 pm on Jun 10, 2010 (gmt 0)

5+ Year Member



OK, I will give that a try, thanks!
5:01 pm on Jun 10, 2010 (gmt 0)

5+ Year Member



That worked...sometimes you just try to make it too hard. :-) Thanks!