Wednesday, 15 February 2012

oracle - SQL join query - selecting from two tables -



oracle - SQL join query - selecting from two tables -

i have query checks table number of fields. 2 tables interested in are: person & person_alternate_id.

i want modify query homecoming value stored in person_alternate_id (if particular person indeed has one)

select distinct person.person_id, person_name, person_address person bring together person_alternate_id on person.person_id=person_alternate_id.person_id person.person_id in (10001,10002,10003);

can suggest how that? looking @ nested select examples, wasn't able implement suitable alter query achieved require. @ moment, query returns fields need person table.

because person may or may not have alternate id, should utilize left join:

select person.person_id, person_name, person_address, person_alternate_id.* person left bring together person_alternate_id on person.person_id=person_alternate_id.person_id person.person_id in (10001,10002,10003);

sql oracle join nested

No comments:

Post a Comment