DELETE FROM shipto
  WHERE shiptoname = ''    AND shiptodepartment_1 = '' AND shiptodepartment_2 = ''
    AND shiptostreet = ''  AND shiptozipcode = ''      AND shiptocity = ''
    AND shiptocountry = '' AND shiptocontact = ''      AND shiptophone = ''
    AND shiptofax = ''     AND shiptoemail = ''        AND shiptogln = ''
    AND module != 'CT'
    AND NOT EXISTS (      SELECT id FROM oe              WHERE oe.shipto_id = shipto.shipto_id
                    UNION SELECT id FROM delivery_orders WHERE delivery_orders.shipto_id = shipto.shipto_id
                    UNION SELECT id FROM ar              WHERE ar.shipto_id = shipto.shipto_id);

-- CVars ignored!
