使用mysql end nodejs,如何获取整个更新后的行?
var query2 = connection.query('UPDATE campaigns SET USED=0 where amount=?' , [amount], function (error, results, fields) {
console.log(query2.sql);
if (error) throw error;
// Get here all updated rows
}使用affectedRows,我只能获得更新后的行数。
发布于 2019-06-28 18:58:05
您可以在更新之前选择所有行的ids,然后更新它们,然后按ids选择它们
第一步:select id from campaigns where amount=?
第二步:update campaigns set USED=0 where amount=?
3d步骤:select * from campaigns where id in (<ids from 1st step>)
https://stackoverflow.com/questions/56804772
复制相似问题