PostgreSQL: insert from another table

后端 未结 4 947
悲&欢浪女
悲&欢浪女 2021-01-30 00:39

I\'m trying to insert data to a table from another table and the tables have only one column in common. The problem is, that the TABLE1 has columns that won\'t accept null value

4条回答
  •  無奈伤痛
    2021-01-30 01:12

    You could use coalesce:

    insert into destination select coalesce(field1,'somedata'),... from source;
    

提交回复
热议问题