\SQL\Aeries SQL
Merge BCY, BST, BCU Between Years.sql
/* Merge STU.BCY, STU.BST, and STU.BCU informaiton between multiple years */ select a.sc, a.sn, a.id, a.fn, a.ln, a.bcy, a.bst, a.bcu , b.sc, b.sn, b.id, b.fn, b.ln, b.bcy, b.bst, b.bcu from dst08000AeriesDemo..stu a inner join dst09000AeriesDemo..stu b on a.id = b.id where (not a.bcy = '' AND b.bcy = '') OR (not a.bst = '' AND b.bst = '') OR (not a.bcu = '' AND b.bcu = '') update b set b.bcy = case when not b.bcy = '' then b.bcy when b.bcy = '' then a.bcy end , b.bst = case when not b.bst = '' then b.bst when b.bst = '' then a.bst end , b.bcu = case when not b.bcu = '' then b.bcu when b.bcu = '' then a.bcu end from dst06000AeriesDemo..stu a inner join dst09000AeriesDemo..stu b on a.id = b.id where (not a.bcy = '' AND b.bcy = '') OR (not a.bst = '' AND b.bst = '') OR (not a.bcu = '' AND b.bcu = '')