consolidate insert query