Hi and thank you for reading.
I have two tables with the same columns. I would like to first table's data to second table. Insert query is very simple: INSERT INTO Table1 SELECT * FROM Table2
. But my problem is when I upgrade OpenERP
, table column positions are changed. So INSERT INTO Table1 SELECT * FROM Table2
query doesn't work. Can you help me to solve this???? Any answers will be highly appreciated...thank you!!!
Table1: Table2:
NAME COUNT NAME COUNT
name1 1 name3 3
name2 2 name4 4
name3 3 name5 5
name4 4 name6 6
SOLUTION: Use information_schema.columns table.
SELECT column_name
FROM information_schema.columns
WHERE table_schema='public' AND table_name='tablename'