-- Build Non-Taxable shipto Tax Groups for tax group hdr -- Jeff Stritar -- March 30, 2020 USE P21PLAY INSERT INTO tax_group_line (tax_group_id , company_id , jurisdiction_id , delete_flag , date_created , date_last_modified , last_maintained_by , taxable) SELECT tax_group_hdr.tax_group_id , tax_group_hdr.company_id , tax_group_line.jurisdiction_id , tax_group_line.delete_flag , CURRENT_TIMESTAMP , CURRENT_TIMESTAMP , 'admin' , 'N' FROM tax_group_hdr JOIN tax_group_line ON LEFT(tax_group_hdr.tax_group_id, 5) = tax_group_line.tax_group_id and tax_group_hdr.company_id = tax_group_line.company_id WHERE len(tax_group_hdr.tax_group_id) = 8 and tax_group_hdr.tax_group_id NOT IN ('ITEM', 'ALL', 'NONE') and tax_group_hdr.tax_group_id LIKE '%_NT' and tax_group_line.delete_flag <> 'Y'