Loop without temp table