insert into na_subscriptions ( aggregator_id, source_id, creation_date ) values ( :aggregator_id, :source_id, now() ) select 1 from na_subscriptions where aggregator_id =:aggregator_id and source_id = :source_id delete from na_subscriptions where source_id = :source_id and aggregator_id =:aggregator_id update na_subscriptions set aggregator_id = :move_to where source_id = :source_id and aggregator_id = :move_from insert into na_subscriptions ( aggregator_id, source_id, creation_date ) values ( :copy_to, :source_id, now() )