0

I'm trying to write a query that extracts and transforms data from a table and then insert those data into target table and that whole table data should be in single column in target table.below is the query I wrote

INSERT INTO Table2 (column1, column2) VALUES
((SELECT * FROM Table1), "seqno");

Table 1

id  | ename  | email  |  country     |
------------------------------------------------
1     d          ..        ..    
2     v          ..        ..      
3     s          ..        ..
4     n          ..        .. 

Expected output:

in table2

src_data  |  src_column  |  seqno  | objectname
-------------------------------------------------
1             eid            1       coustomer master
2             eid            2       coustomer master        
3             eid            3       coustomer master
4             eid            4       coustomer master
d             ename          1       coustomer master
v             ename          2       coustomer master
s             ename          3       coustomer master
n             ename          4       coustomer master
email1        email          1       coustomer master
email2        email          2       coustomer master
email3        email          3       coustomer master
email4        email          4       coustomer master
country1      country        1       coustomer master
country2      country        2       coustomer master
country3      country        3       coustomer master
country4      country        4       coustomer master

How can I achieve this?

Please help me to rectify this

0 Answers0