I’m trying to update the table multiple times using an array in oneline sql code.

const updateSectionsNumber = (request, response) => {
    let sectionNumbers = [3, 4];
    let newSectionNumbers = [2, 3];
    async function updateData(){
        try {
            const response = await new Promise((resolve, reject) => {
                const query = "UPDATE content SET sectionNumber = ? WHERE sectionNumber = ?";
    
                connection.query(query, [newSectionNumbers, sectionNumbers] , (err, result) => {
                    if (err) reject(new Error(err.message));
                    resolve(result.affectedRows);
                })
            });
    
            return response === 1 ? true : false;
        } catch (error) {
            console.log(error);
            return false;
        }
    }
    
    updateData()
    .then(data => response.json({data : data}))
    .catch(err => console.log(err));
}

I tried this, the same error “Cannot read properties of undefined (reading ‘affectedRows’)”

const query = "UPDATE content SET sectionNumber IN (?) WHERE sectionNumber IN (?)";