I am using Peoplesoft's query manager (web-based) and don't know if the following is even possible.
PROBLEM:
The records in one table.
Term Test
1074 1-1
1068 1-1
1056 1-1
1074 2-1
1056 2-1
1074 3-1
RESULTS NEEDED:
Have 2 term fields retrieved. 1074 for 1 term field and just the prior term that the test was offered for the 2nd term field so it would look like:
Term Test Prior Term
1074 1-1 1068
1074 2-1 1056
1074 3-1 blank since this is the first term that the test was offered.
The following oracle select statement was given to me to get the results and I don't know if it is possible using the query manager (i.e. how to get dense_rank... in the query):
select term, test, ld "PRIOR TERM"
from (
select t.*,
dense_rank( ) over( partition by test order by term desc ) rnk,
lead( term ) over( partition by test order by term desc ) ld
from t
)
where rnk = 1
order by test, term desc
If this isn't possible then does anyone have any idea how to get the results I need using the query manager.
Help is appreciated. Thanks
PROBLEM:
The records in one table.
Term Test
1074 1-1
1068 1-1
1056 1-1
1074 2-1
1056 2-1
1074 3-1
RESULTS NEEDED:
Have 2 term fields retrieved. 1074 for 1 term field and just the prior term that the test was offered for the 2nd term field so it would look like:
Term Test Prior Term
1074 1-1 1068
1074 2-1 1056
1074 3-1 blank since this is the first term that the test was offered.
The following oracle select statement was given to me to get the results and I don't know if it is possible using the query manager (i.e. how to get dense_rank... in the query):
select term, test, ld "PRIOR TERM"
from (
select t.*,
dense_rank( ) over( partition by test order by term desc ) rnk,
lead( term ) over( partition by test order by term desc ) ld
from t
)
where rnk = 1
order by test, term desc
If this isn't possible then does anyone have any idea how to get the results I need using the query manager.
Help is appreciated. Thanks