Monday, November 14, 2011

Sql server 2005 query question?

is there a way to query from the same column based on 3 different 'where' cases. I.e. I need to count the repetition of colors in a database. So lets say, its the column is t-shirts. I want to select count the number of t-shirts that are red, yellow and green. I don't think its doable... like select count tshirts where tshirt = green, where tshirt = yellow, and tshirt = red (thats pseudo sql.. too lazy to look up my actual code).. and it return a column with those 3 values? So far im using a temporary table, i was wondering if you could do it in one query?

No comments:

Post a Comment