Home » SQL & PL/SQL » SQL & PL/SQL » Data retrievel from two tables Problem (Union functionality)
Data retrievel from two tables Problem [message #273144] Tue, 09 October 2007 03:37 Go to next message
nus_uday
Messages: 2
Registered: July 2007
Junior Member
Hi All,

I have a scenario like ,

I have to retrieve data from two tables which have 4 columns similar and second table has one column extra but i need to include that extra column also in select list. This one won't work UNION.

If you have any solution for this scenario pls. reply urgently.

Thanks

Uday

[Updated on: Tue, 09 October 2007 07:46] by Moderator

Report message to a moderator

Re: Data retrievel from two tables Problem [message #273147 is a reply to message #273144] Tue, 09 October 2007 03:56 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Assign a dummy variable to your select list where the column is missing:
SELECT col1
     , col2
     , 'N/A' extra_col
FROM   table1
UNION ALL
SELECT col1
     , col2
     , extra_col
FROM   table2
/
MHE
Re: Data retrievel from two tables Problem [message #273148 is a reply to message #273147] Tue, 09 October 2007 04:07 Go to previous message
nus_uday
Messages: 2
Registered: July 2007
Junior Member
Thanks Maaher

It's working...


UDay
Previous Topic: Save PDF or Image File in Database
Next Topic: increasing the performance of query
Goto Forum:
  


Current Time: Sun Dec 04 00:11:11 CST 2016

Total time taken to generate the page: 0.04738 seconds