Posts

Showing posts with the label jointable

Selecting Matching values from three different table and combining them in one table in Oracle

Selecting Matching values from three different table and combining them in one table in Oracle I have Four tables as follows Review (REV_ID pk , REV_NAME) Meeting (MEETING_ID pk,MEETING_NAME,REV_ID fk to Review) Task (TASK_ID pk,TASK_NAME,REV_ID fk to Review) Answer (ANS_ID pk,ANS_NAME,REV_ID fk to Review) Now I want to select a particular Review and want to create a table with Linked meetings Linked answers Linked tasks How shall I proceed with it? I tried writing join query but I was only able to get data if Rev_ID is present in all tables? select * from (SELECT * FROM meeting WHERE EXISTS (SELECT * FROM review WHERE meeting.rev_id =review.rev_id) and meeting.rev_id=142), (SELECT * FROM answer WHERE EXISTS (SELECT * FROM review WHERE answer.rev_id =rev.rev_id) and answer.ans_rev_id=142), (SELECT * FROM task WHERE EXISTS (SELECT * FROM review WHERE task.rev_id =review.rev_id) and task.rev_id=142) r; Note : Here I tried static Rev_ID =142 to ch...