how do i merge two tables making the first to come under the second table having same column size | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how do i merge two tables making the first to come under the second table having same column size

please i am working on my school project, i need your help.... i have 2 tables: stash, exp, and i need to merge (join) the 2 tables in a particular way; example: ======== stash id date amount comment 1 9/1/17 400 shoes 2 10/1/17 150 dash 3 12/1/17 100 dash exp id date cash comment 1 9/1/17 200 shoes 2 11/1/17 200 shoes i want to select `date`, `amount` column from `stash` table and also select `date`,`amount` column from `expenditure ` table and make it one new table,and sort data to its own date like this==> date amount cash ----------------------------------------- 9/1/17 400 200 ----------------------------------------- 10/1/17 150 0 ---------------------------------------- 11/1/17 0 200 ---------------------------------------- 12/1/17 100 0 ---------------------------------------- note that it arranged the data on the table according to date, thanks

22nd Nov 2017, 10:27 PM
Sampson Joshua (Jozy)
Sampson Joshua (Jozy) - avatar
1 Answer
0
SELECT stash.id, stash.date, stash.amount, exp.id, exp.date, exp.cash FROM stash, exp WHERE stash.id = exp.id ORDER BY stash.id;
1st Dec 2017, 9:09 PM
BodyaBuilder
BodyaBuilder - avatar