cursor - Oracle query to compare result row with another and output if match found -


I have a dataset and I am trying to find the results of each other's reference. I have a table with "apps" in it. There are 2 parties (people) involved with an application, these are "applicants" and "receivers".

I have to find out how to get the data where the person "A" is an applicant and the person "B" has been a receiver and then forwarded to another application in reverse, so where the person "B" The applicant and the person "A" is the receiver, I will have to return those two rows as a line in my set of results.

My data structure looks like this:

  Application ID, applicant's name, applicant DOB, recipient name, receiver DOB1, Bob Smith, 12/06/1980 , Joe Smith, 10/10/1979 2, Joe Smith, 10/10/1979, Bob Smith, 12/06/1980 3, Betie Davis, 15/05/1987, Barry Davis, 29/07/1981 4 , Barry Davis, 29/07/1981, Betty Deis, 15/05/1986   

As you can see that there are 4 apps but in fact only 2 "cross applications" I find unique Showing cross application:

  application ID 1, applicant's name 1, applicant DOB 1, recipient's name1, receiver DOB1, application ID2, applicant's name 2, applicant DOB 2, receiver name 2, receiver DOB 2 1, Bob Smith, 12/06 / 1980, Joe Smith, 10/10/1979, 2, Joe Smith, 10/10/1979, Bob Smith, 12/06/1980 3, Betty Davis, 15/05/1986, Barry Davis, 29/07/1981, 4, Barry Davis, 29/07/1981, Betty Deis, 15/05/1986   

I can only compare between two things, only name and DOB (this is an obstacle for me It's annoying because sometimes C names are different or put in the wrong DOB). I just want to return the cross-application, where both people are matching.

I think I will need to load the line "N" and the date of birth date and compare in each cursor with every other line in the dataset (to N + 1nn) and any mail If you are not found then put them in the output and move on to the next line I am not sure how to do this and if someone can give advice then she wants some help Thanks!

"itemprop =" text ">

Please try below

  select A.Application_ID" application ID 1 ", AAPPLICIENTName" applicant_name 1 ", AAPPLICANT DOB" applicant_obb 1 ", a. Receiver_name "receiver_name 1", a. Receiver DOB "Receiver DOB1", B.Applications_ID "Application ID2", BAPPleentName "applicant_name 2", BAPPLICANT DOB "Applicant_DOB12", B.Receiver_Name "Receiver_Name2", B.Receiver_DOB from "Receiver_DOB2" application, Where B. Application A.Applicant_Name = B.Receiver_Name and B.Applicant_Name = A.Receiver_Name and B.Receiver_DOB = A.Applicant_DOB and A receiver DOB = B. APPLICANT DOB;    

Comments