-1

I have two tables.

Table_Sale

S_Date
S_Store
S_Item_ID
S_Qty

Table_Return

R_Date
R_Store
R_Item_ID
R_Qty

Imagine Table_Sale have 1000 row and Table_Return have 250 rows.I want to do
this cindition.
(S_Date=R_Date and S_Store=R_Store and S_Item_ID=R_Item_ID)


Think there are 150 rows match with that condition. Then there are 850 Rows from Table_Sale and 100 row in Table_Return which are not matching with the condition. Now I want 150+100+850 all data in a one table. How can I make the join sir.?Please anyone help me.

Community
  • 1
  • 1
Hasan Dulanga
  • 73
  • 1
  • 11
  • You would get much better help, if you set up a test-scenario, with just a few rows. Then state the expected output and what you've tried so far... – Shnugo May 09 '16 at 09:58

1 Answers1

1

You should use a FULL OUTER JOIN. Something like this...

SELECT *
FROM Table_Sale a
FULL OUTER JOIN Table_Return b ON a.S_Date = b.R_Date 
                              and a.S_Store = b.R_Store
                              and a.S_Item_ID = b.R_Item_ID
Isaac
  • 3,240
  • 2
  • 24
  • 31