homepage Welcome to WebmasterWorld Guest from 54.237.38.30
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Help with MS SQL query
IntegrityWebDev

5+ Year Member



 
Msg#: 4149897 posted 7:15 pm on Jun 9, 2010 (gmt 0)

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

 

LifeinAsia

WebmasterWorld Administrator lifeinasia us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4149897 posted 8:59 pm on Jun 9, 2010 (gmt 0)

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.

IntegrityWebDev

5+ Year Member



 
Msg#: 4149897 posted 12:10 pm on Jun 10, 2010 (gmt 0)

OK, I will give that a try, thanks!

IntegrityWebDev

5+ Year Member



 
Msg#: 4149897 posted 5:01 pm on Jun 10, 2010 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved