Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
| Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2010, 02:06 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tusharkale
Default SQL joio query

Hello,

I have two select statements as

Query 1 : Select col1,col2,col3,col4,value_a from table_1

Query 2: Select col1,col2,col3,col4,value_b from table_2

I want to join these two select statement to get below result.

col1 col2 col3 col4 value_a value_b


Scenario 1: Both query fecth the result

Result of query 1:

Col1 Col 2 Col3 Col4 Value_a
1 TK TL TM 100

Result of query 1:

Col1 Col 2 Col3 Col4 Value_b
1 TK TL TM 200

Ultimate join result should be
Col1 Col 2 Col3 Col4 Value_a value_b
1 TK TL TM 100 200


Scenario 2: Only one query fetches the result


Result of query 1:

Col1 Col 2 Col3 Col4 Value_a
1 TN TO TP 300

Result of query 1:

Col1 Col 2 Col3 Col4 Value_b

Ultimate join result should be
Col1 Col 2 Col3 Col4 Value_a value_b
1 TN TO TP 300 0

How should I join these?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help in SQL Query skhan BOOK: Beginning SQL 10 September 1st, 2009 10:17 PM
sql query ldp101068 SQL Server 2000 7 December 18th, 2007 04:52 PM
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
sql query plug_samir SQL Server 2000 1 May 17th, 2005 08:26 AM
SQL Query help ruthless Classic ASP Basics 1 December 21st, 2004 06:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.