Iver Erling Arva
asked on
Selecting and comparing row pairs in oracle sql
ASKER
Thx! But there is still a problem. Here is my actual code:
I get an error message saying ORA-00904: "MYRN": invalid identifier.
iVer
select CUST_NO "Customer number",
NAME "Name",
CIVIL_REG_CODE "Personal reg no",
DISABILITY_PCT "DSP per centage",
trunc(TIMESTAMP)
from (select t.CUST_NO,n.NAME,n.Civil_Reg_Code,t.DISABILITY_PCT,t.TIMESTAMP, row_number()
over(partition by t.CUST_NO ORDER BY t.CUST_NO, t.TIMESTAMP DESC) myrn
from TIA.OBJ_IPGEN t, TIA.NAME n
where myrn <= 2
and n.ID_NO = t.CUST_NO
and t.suc_seq_no IS NULL
and t.DISABILITY_PCT <> 0)
I get an error message saying ORA-00904: "MYRN": invalid identifier.
iVer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
iVer,
Can I ask why there wasn't a point split since the accepted answer was built off a previous post and why the penalty grade of a "B"?
Please review:
http://support.experts-exchange.com/customer/portal/articles/481419-what-grade-should-i-award-?b_id=44
and:
http://support.experts-exchange.com/customer/portal/articles/608596-how-do-i-accept-multiple-comments-as-my-solution-?b_id=44
Can I ask why there wasn't a point split since the accepted answer was built off a previous post and why the penalty grade of a "B"?
Please review:
http://support.experts-exchange.com/customer/portal/articles/481419-what-grade-should-i-award-?b_id=44
and:
http://support.experts-exchange.com/customer/portal/articles/608596-how-do-i-accept-multiple-comments-as-my-solution-?b_id=44
I had to change the column names since I don't think you can have a column in a table in oracle called date. Not sure about data but changed that just in case.
Open in new window