pool.query('SELECT .... FROM ... WHERE ...', function(ers, rows, fields) { for(i = 0; i < items.length; i++) { if(rows[0].id !== items[i].id) continue; } });