Home » RDBMS Server » Server Administration » Using Alias's with INNER JOIN
|
Re: Using Alias's with INNER JOIN [message #372328 is a reply to message #372325] |
Fri, 02 February 2001 13:38 |
Andrew again...
Messages: 270 Registered: July 2000
|
Senior Member |
|
|
In oracle, there are 2 types of joins:
1.) Inner join (syntax a.id=b.id)
2.) Outer join (syntax a.id=b.id(+) or a.id(+)=b.id)
Does this example help?
create table profile (id number, description varchar2(20));
insert into profile values(1, 'First Profile');
insert into profile values(2, 'Second Profile');
insert into profile values(3, 'Third Profile');
create table t1 (id number, type varchar2(10), value varchar2(20));
insert into t1 values(1, 'Name', 'Oracle');
insert into t1 values(1, 'Age', '30');
insert into t1 values(1, 'sex', 'Male');
insert into t1 values(2, 'Name', 'Orafans');
insert into t1 values(2, 'Age', '25');
insert into t1 values(2, 'sex',null);
insert into t1 values(3, 'Name', 'bwithu');
insert into t1 values(3, 'Age', null);
insert into t1 values(3, 'sex', null);
select p.id, p.description, a.value ||' '||b.value||' '||c.value All_together
from profile p, t1 a, t1 b, t1 c
where p.id= a.id
and p.id = b.id
and p.id = c.id
and a.type = 'Name'
and b.type = 'Age'
and c.type = 'sex';
|
|
|
|
Goto Forum:
Current Time: Mon Dec 23 00:32:40 CST 2024
|