Home » SQL & PL/SQL » SQL & PL/SQL » Compare two rows from a same table
Compare two rows from a same table [message #623875] Mon, 15 September 2014 15:05 Go to next message
deepugun
Messages: 6
Registered: January 2014
Junior Member
Hello All,
I have a table in which i have sets of two records with the same Composite Key identifier (two columns i.e.REPORT_NBR,REPORT_ID_NBR ) but with different Report_RUN_DT. I would now like to identify which columns exactly changed between those two records for each set .I would also like to some how generate a user friendly report.Please see the table structure below.
REPORT_NBR	REPORT_ID_NBR	Report_RUN_DT	DOC_SIGND_DT	DOC_RCVD_DT
100	             9081	3-Feb-14	        11-DEC-02	16-DEC-02
100	             9081	02-MAR-14	11-DEC-02	17-DEC-02
100	             9082	3-APR-14	        11-DEC-02	16-DEC-02
100	             9082	02-MAY-14	11-DEC-02	17-DEC-02


Based on the data i would like to compare between the Latest Report_Run_DT record with old Report_Run_DT record and some how generate a report displaying the old value and new value for the changed DOC_RCVD_DT.
Thanks for the help!!

*BlackSwan added {code} tags.
Please do so yourself in the future. see http://www.orafaq.com/forum/t/174502/

[Updated on: Mon, 15 September 2014 15:55] by Moderator

Report message to a moderator

Re: Compare two rows from a same table [message #623879 is a reply to message #623875] Mon, 15 September 2014 16:05 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: Compare two rows from a same table [message #623893 is a reply to message #623875] Tue, 16 September 2014 01:21 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

From one of your previous topic:

BlackSwan wrote on Tue, 08 April 2014 02:37
...
Since we don't have your tables or data, we can not compile, run or test posted code.
It would be helpful if you provided DDL (CREATE TABLE ...) for tables involved.
It would be helpful if you provided DML (INSERT INTO ...) for test data.
It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/311
It would be helpful if you provided expected/desired results & a detailed explanation how & why the test data gets transformed or organized.
...


In addition, if you want people continue to help you maybe you should think to feedback and thank them.

Previous Topic: Several rows data in a column adding in one row group by catagory
Next Topic: regexp_replace. Add double quote(") to string of values
Goto Forum:
  


Current Time: Thu Apr 25 06:04:08 CDT 2024