insert values into temp table using select