Sql insert for each distinct value