0

Could you please help me below query.

enter image description here

Table 1 (Input)had three columns (Credit_date, Debit_date, Payment_date) and Table 2 (Output) has one column date

The three column values from Table 1 should be available in Table 2.

I tried below query but not working.

insert into table2
select date 
from (
 (select credit_date, debit_date, Payment_date from table 1) as date)t;

Could you please guide.

smp97
  • 63
  • 6

1 Answers1

1

Try doing a union all:

insert into table2 
select * from (
select credit_date as date from table1
union all
select debit_date as date from table1
union all
select payment_date as date from table1
) t
mck
  • 40,932
  • 13
  • 35
  • 50