Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Skapa backup tabell
- create table bu_36377_donorAddDonorType as select * from donor_additional_donor_type;
- --Verifiering
- select * from bu_36377_donorAddDonorType;
- --Kontroll av antal före uppdatering
- select count(*) from donor where not id in (select id from donor_additional_donor_type where donor_type='LAB')
- and donor_type='BLOOD'
- and (DEREGISTRATION_TYPE is null or DEREGISTRATION_TYPE='MAY_RETURN');
- -- Insert i tabellen
- INSERT INTO DONOR_ADDITIONAL_DONOR_TYPE t (ID, DONOR_TYPE)
- select id, 'LAB' as DONOR_TYPE from donor where not id in (select id from donor_additional_donor_type where donor_type='LAB')
- and donor_type='BLOOD'
- and (DEREGISTRATION_TYPE is null or DEREGISTRATION_TYPE='MAY_RETURN');
- --Kontroll av antal efter uppdatering och då MÅSTE alltid vara 0 rader
- select count(*) from donor where not id in (select id from donor_additional_donor_type where donor_type='LAB')
- and donor_type='BLOOD'
- and (DEREGISTRATION_TYPE is null or DEREGISTRATION_TYPE='MAY_RETURN');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement