select p.category_id, p.amount from iv_prices p, cr_items i where p.list_id = :list_id and p.price_id = i.latest_revision select price_id, item_id, category_id from iv_pricesi where list_id = :list_id update cr_items set latest_revision = null, live_revision = null where item_id in (select item_id from iv_pricesi where list_id = :list_id)