Select with conditions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shisou
    New Member
    • Jul 2007
    • 52

    Select with conditions

    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...

    Code:
    SELECT description AS activeDesc 
    FROM table 
    WHERE name1 = value and name2 = active
    and

    Code:
    SELECT description AS inactiveDesc 
    FROM table 
    WHERE name1 = value and name2 = inactive
    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!
    Last edited by Shisou; Sep 23 '09, 07:55 PM. Reason: Make code easier to read
  • Shisou
    New Member
    • Jul 2007
    • 52

    #2
    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!

    Comment

    Working...