-
Hi
I have two tables abc and xyz
SQL> create table xyz (id number(10), name varchar2(20));
Table created.
SQL> create table abc (id1 number(10), name1 varchar2(20));
Table created.
SQL> insert into xyz values(1,'bbb');
1 row created.
SQL> insert into abc values(1,'aaa');
1 row created.
Now I want the output as following
ID Name
==========
1 bbb
1 aaa
Is it posible? Let me know.
Thanks.
-
Hi
I know I can do with union .
But, If I have inserted the raw
insert into abc values(3,'ccc');
I DON"T WANT result like this
ID NAME
-----------
1 aaa
1 bbb
3 ccc
I want the result as folloing
ID NAME
----------
1 aaa
1 bbb
Let me know.
Thanks.
-
ora_inf,
Can you explain how you want to decide which rows to include in the result set.
If your table contains:
1 aaa
2 bbb
3 ccc
How should I decide which of these rows to return? By id, name or ?
-
If you only want to get the rows with id = 1
then
select * from abc where id = 1
union
select * from xyz where id = 1;
Sanjay
-
if you want to join tables then:
select a.*
from abc a,
xyz b
where a.id = b.id
union
select b.*
from abc a,
xyz b
where a.id = b.id
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|