anup
Answered On : Jun 22nd, 2012
you can specify a sql query in source qualifier like
Select name,sal from Employee order by sal---it is used to sort the salary column so that the max salary will be in the starting
still we have one more issue
If two or more persons have the highest salary then the second row wont be the second highest salary so inorder to get the 2nd highest salary
-- Take an expression transformation
-- pass the sal as input port--I_sal (input + output port)
-- create a variable port-- v_sal which has the value of I_sal
-- Create another variable port v_logic which has the expression as IIF(v_sal=v_prevsal,NO,secondHighsal)
which returns No if the current sal and previous salary are equal if not it will return secondHighsal
--create one more output port -- v_result as string and give the value of v_logic to it
--create a variable port v_prevsal
make sure that this port should be created after the variable port in which we gave the expression
because it should retain the previous value when it is being used.
-- Next create a filter transformation and pass the I_sal and v_Result ports to that and check the V_result for the
seconHighSal value and pass the respective sal to target
Hope you will get the solution
Login to rate this answer.
PSUNIL
Answered On : Aug 7th, 2012
USING DENSE RANK U CAN GET IT
Code
SELECT SALARY FROM
(SELECT SALARY ,DENSE_RANK() OVER(ORDER BY SALARY) AS DENSE_RANK FROM EMP)
WHERE DENSE_RANK=2;
Login to rate this answer.
purvi
Answered On : Aug 7th, 2012
select max(salary) from EmpTable where salary not in (select max(salary) from EmpTable));
Login to rate this answer.
NagaRaja
Answered On : Aug 17th, 2012
Select Max(Salary) from Emp Where Salary < (Select Max(Salary) from Emp)
Login to rate this answer.