Connecting Tech Pros Worldwide Forums | Help | Site Map

Select with conditions

Member
 
Join Date: Jul 2007
Posts: 52
#1: Sep 23 '09
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!

Member
 
Join Date: Jul 2007
Posts: 52
#2: Sep 23 '09

re: Select with conditions


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!
Reply