By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,856 Members | 2,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,856 IT Pros & Developers. It's quick & easy.

Select with conditions

P: 52
After pulling my hair out, I've decided to ask the experts...

I need to create a SQL select statement to pull from multiple tables, which is easy enough. The hard part is, I have two variables I need to fill activeDesc and inactiveDesc both are from the same table and same row.

Basically what I need is for both of them to have their own seperate select statement, for example...

Expand|Select|Wrap|Line Numbers
  1. SELECT description AS activeDesc 
  2. FROM table 
  3. WHERE name1 = value and name2 = active
  4.  
and

Expand|Select|Wrap|Line Numbers
  1. SELECT description AS inactiveDesc 
  2. FROM table 
  3. WHERE name1 = value and name2 = inactive
  4.  
The problem is that I have to do this with 1 query and the query has to pull all the data from a view that is already setup at the same time... I'm a little bit at a loss so if anyone can help I'd really appreciate it!
Sep 23 '09 #1
Share this Question
Share on Google+
1 Reply


P: 52
Disregard this, I figured it out! WOO go me!

anyone who is curious, I added parenthesized select statements into the select in my view and added the fields to the view!
Sep 23 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.