Hi,
I have a query that returns the last 3 salaries of employees but I want to display the results in 1 row as Sal1, Sal2, Sal3. Anybody know how to do this?
My query is:
select b.REFNO, s.SA02D, s.SA04P from basic b, salary_history s
where b.BGROUP = s.BGROUP
and b.REFNO = s.REFNO
and s.SA02D in (select sh1.sa02d from (select sh.SA02D, refno
from salary_history sh
order by sh.SA02D desc) sh1
where rownum <=3
and sh1.refno = b.refno)
and b.SD01X = '8025'
order by b.refno, s.SA02D desc;
Cheers,
Daniel.
I have a query that returns the last 3 salaries of employees but I want to display the results in 1 row as Sal1, Sal2, Sal3. Anybody know how to do this?
My query is:
select b.REFNO, s.SA02D, s.SA04P from basic b, salary_history s
where b.BGROUP = s.BGROUP
and b.REFNO = s.REFNO
and s.SA02D in (select sh1.sa02d from (select sh.SA02D, refno
from salary_history sh
order by sh.SA02D desc) sh1
where rownum <=3
and sh1.refno = b.refno)
and b.SD01X = '8025'
order by b.refno, s.SA02D desc;
Cheers,
Daniel.