sql - PostgreSQL insert into from select but ignore existing rows -
i want insert data table select. works fine far...
insert table_2 select t.id, 1 table_1 t t.title '%search%';
but when run second time, statement raises exception, because of rows exist.
what can around this?
thanks help, urkman
you can insert rows don't exist, adding clause.
insert table_2 select t.id, 1 table_1 t t.title '%search%' , not exists (select t2.id table_2 t2 t2.id = t.id);
Comments
Post a Comment