begin;

select * from archive_burned order by archive_id,part,copy;

select * into a from archive_burned where archive_id in (select archive_id from archive_burned group by archive_id having sum(copy) < 2) ;

update a set copy = 2 ;

insert into archive_burned select * from a;

select * from archive_burned order by archive_id,part,copy;

drop table a ;

-- alternative
-- insert into archive_burned select archive_id,date,part,2,iso_size from archive_burned where archive_id in (select archive_id from archive_burned group by archive_id having count(*) = 1);

