Re: How to retrieve this data as a single row with three new columns
Posted by: Rick James
Date: September 07, 2012 10:34PM

Here's one way:
SELECT  f.child_id, f.mother_id, f.father_id,
        f.address, f.household_income,
        uc.name AS child_name,
        um.name AS mother_name,
        uf.name AS father_name
    FROM  family AS f
    JOIN  user AS uc ON uc.user_id = f.child_id
    JOIN  user AS um ON um.user_id = f.mother_id
    JOIN  user AS uf ON uf.user_id = f.father_id;

Options: ReplyQuote


Subject
Written By
Posted
Re: How to retrieve this data as a single row with three new columns
September 07, 2012 10:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.