mysql - 节点Mysql更新行使用2个条件传递2个参数(ID)
问题描述
我已经用 1 个 id 做了 npoint 并且效果很好,现在我的疑问是如何传递 2 个 id?因为我必须在查询中使用 2 个条件来更新行,而且我也不知道如何制作路线。任何想法,建议?
updateEstadoPatient: (req, res) => {
const id = req.params.id;
updateEstadoPatient(id, (err, results) => {
if (err) {
console.log(err);
return;
}
if (!results) {
return res.json({
success: 0,
message: "Erro ao atualizar o estado do utente"
})
}
return res.json({
success: 1,
message: "Estado do utente atulizado com sucesso"
})
})
}
updateEstadoPatient: (id, callBack) => {
pool.query(
`UPDATE PEDIDOS_LINHAS SET DATAINI = current_timestamp() WHERE COD_PEDIDO = ? AND NUMPEDIDO = ?;`,
[
[id],
],
(error, results, fields) => {
if (error) {
return callBack(error);
}
return callBack(null, results)
}
)
}
router.patch('/patient/:id', updatePatient);
解决方案
推荐阅读
- matlab - 使用 Matlab 向程序发送用户名和密码
- javascript - 我们可以使用 flv.js 播放器播放 .m3u8 文件吗?
- r - 如何获得由 venn-package 在 R 中绘制的 venn 图的公共部分的值
- mysql - 如果我添加一列作为枚举列表,一行有很多类别,那么它会是有效的还是有更好的方法来做到这一点?
- openstreetmap - 不通过更新的提名数据更新光子
- php - 如何连接两列值,例如 - 产品名称(产品数量),......来自while循环中的表并存储在变量中
- python - 在 Keras 中读取 LSTM 文本时如何修复此“UnicodeEncodeError”/“TypeError”
- r - 调整 tmap 中的图例大小
- codeigniter - 如何在codeigniter中使用带有like的连接表以及在like中使用多列
- javascript - Angular 表单验证,在 HTML 上迭代时访问表单控件