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?
|