Joined two tables on one row [message #679775] |
Wed, 25 March 2020 11:21  |
 |
Gin min
Messages: 5 Registered: March 2020
|
Junior Member |
|
|
Hi.
I need help about the query.
For example. Two tables one stock_in and 2nd stock_out.
Stock_in
Date product name qty
1/03/20 ABC 100
3/03/20 ABC 200
6/03/20 ABC 100
stock_out
Date product name qty
4/03/20 ABC 50
5/03/20 ABC 100
Sir,
I nèed Result this.
Date product name qty
1/03/20 ABC 100
3/03/20 ABC 200
4/03/20 ABC 50
5/03/20 ABC 100
6/03/20 ABC 100
Please guid me
|
|
|
Re: Joined two tables on one row [message #679776 is a reply to message #679775] |
Wed, 25 March 2020 11:26   |
 |
Michel Cadot
Messages: 68757 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Welcome to the forum.
Please read the OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Align the columns in result.
Also always post your Oracle version, with 4 decimals (query v$version), as often solution depends on it.
With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
Have a look at FULL OUTER JOIN.
Now you have to answer the question: what should be the result in case there is the same date for the same product in both tables?
[Updated on: Wed, 25 March 2020 11:29] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Joined two tables on one row [message #679782 is a reply to message #679781] |
Thu, 26 March 2020 04:03   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Do you understand what UNION ALL does?
If not read the documentation
Do you understand what ORDER BY does?
If not read the documentation, and maybe do a SQL course
If you understand those two this is incredibly simple. So think about it and have a go instead of assuming this is too hard for you.
|
|
|
|
|