Home » SQL & PL/SQL » SQL & PL/SQL » select from two tables
select from two tables [message #636695] Thu, 30 April 2015 05:38 Go to next message
amjad_alahdal
Messages: 92
Registered: October 2013
Location: Saudi Arabia
Member
Hi guys,
I have table
A 
name id
a  1
b  2 
table 
B
name id 
c  3
d  4


How can I create a select statement that give me the records of table A and table B?

[Updated on: Thu, 30 April 2015 05:44] by Moderator

Report message to a moderator

Re: select from two tables [message #636697 is a reply to message #636695] Thu, 30 April 2015 05:44 Go to previous messageGo to next message
Roachcoach
Messages: 1491
Registered: May 2010
Location: UK
Senior Member
select * from a,b

[Updated on: Thu, 30 April 2015 05:44]

Report message to a moderator

Re: select from two tables [message #636698 is a reply to message #636697] Thu, 30 April 2015 05:51 Go to previous messageGo to next message
amjad_alahdal
Messages: 92
Registered: October 2013
Location: Saudi Arabia
Member
I am afraid that is not how to do it
select * from a union all select * from b ;
Re: select from two tables [message #636699 is a reply to message #636698] Thu, 30 April 2015 06:00 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3123
Registered: May 2013
Location: World Wide on the Web
Senior Member
So you must show your desired output.

Read How to post a test case.
Read How to ask questions.
Read the OraFAQ Forum Guide

[Updated on: Thu, 30 April 2015 06:02]

Report message to a moderator

Re: select from two tables [message #636702 is a reply to message #636699] Thu, 30 April 2015 06:28 Go to previous messageGo to next message
Michel Cadot
Messages: 65166
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

... and feedback to and thank people who help you.

Re: select from two tables [message #636716 is a reply to message #636698] Thu, 30 April 2015 12:31 Go to previous messageGo to next message
joy_division
Messages: 4777
Registered: February 2005
Location: East Coast USA
Senior Member
amjad_alahdal wrote on Thu, 30 April 2015 06:51
I am afraid that is not how to do it
select * from a union all select * from b ;


If you knew the answer, why did you ask?
Re: select from two tables [message #664497 is a reply to message #636716] Thu, 20 July 2017 05:48 Go to previous message
amjad_alahdal
Messages: 92
Registered: October 2013
Location: Saudi Arabia
Member
I hadn't known the answer. I read and tried and it worked. Thank You for your reply.
Previous Topic: How to fetch rows having only numbers in a varchar2 column
Next Topic: Need help to Learn PL\SQL
Goto Forum:
  


Current Time: Tue Sep 19 10:29:54 CDT 2017

Total time taken to generate the page: 0.01659 seconds