UPDATE tblitems i
LEFT JOIN tblitems_groups ig ON ig.tenant_id = i.tenant_id AND ig.name = 'Services'
SET i.group_id = COALESCE(ig.id, 0)
WHERE i.group_id = 0;