DontKnow DontKnow - 3 years ago 103
SQL Question

Oracle NOT pl/sql

I would like to do a select AFTER I do a case statment


select x from dual ( x is actually a variable in a report writer tool)
case when x = 'equipment'
select * from inside_sales
select * from outside_sales

can't use PL/SQL

any help would be appreciated

Answer Source

I think you want this:

select * from inside_sales where x = 'equipment'
union all
select * from outside_sales where x <> 'equipment';

Note: The second condition is slightly more complicated if x can be NULL.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download