Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Merge 2 select statements ?

Re: Merge 2 select statements ?

From: mhk <cccssss_at_dddsssl.com>
Date: Thu, 27 Nov 2003 15:48:14 -0600
Message-ID: <3FC6711E.6080605@dddsssl.com>


Thank you Sooo much , i like the second one and changed it little bit like following for the testing.

select
ename ,
sal,
comm,
(case when sal =1600 and comm = 300 then 4 when sal = 1250 and comm = 500 then 1 else 0 end ) as Rate
from emp where sal <> 0
order by rate desc, ename ;

it works well.
I really appreciate your help

Jeff


Thomas Kellerer wrote:
> mhk schrieb:
>

>> Thanks but ,
>>
>> As i said earlier i need to merge two tough separate select statement 
>> in reality.

>
> Then you should have given the tough one at once :-)
>
>
>> Please help me in merging this following select Statements
>>
>>
>> select ename, '3' As rate from emp where sal = 950;
>>
>> other is
>>
>> select ename, '1' As rate from emp where sal = 11950;
>>
>>

>
> SELECT ename,
> decode( sal,950,'3',11950,'1','')
> FROM emp
> WHERE sal = 950
> OR sal = 11950
>
> or
>
> SELECT ename,
> CASE sal
> WHEN 950 THEN '1'
> WHEN 11950 THEN '2'
> ELSE ''
> END
> FROM emp
> WHERE sal = 950
> OR sal = 11950
>
>
Received on Thu Nov 27 2003 - 15:48:14 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US