-6

Consider the tables listed below

Table credit

id    cr_amount  created_date
1     1000       2011-07-01
2     2000       2011-07-08
3     6000       2011-07-09

And Table debit entries are follows.

id   dr_amount  created_date
1    3000       2011-07-09

Need to read columns cr_amount, dr_amount and created_date from above tables in ordered by created date as shown below.

cr_amount  dr_amount   created_date
1000        NULL         2011-07-01
2000        NULL         2011-07-08
6000        NULL         2011-07-22
NULL        3000         2011-07-09
Mable John
  • 4,518
  • 3
  • 22
  • 35

1 Answers1

2

You may need to put both columns in the union all:

select cr_amount,Null as 'db_amount',created from table_credit
union all
select Null,db_amount,created from table_debit
order by created
Jayvee
  • 10,670
  • 3
  • 29
  • 40