我正在尝试基于 2 个选择子查询更新表,该子查询将相乘以生成 Harga 列的值
这是我的代码:
UPDATE bahanmakanan
SET Harga = (SELECT HargaSatuan from detail_bahanmakanan
WHERE IDBahanMakanan = "BM01")* (SELECT jumlah from bahanmakanan
WHERE IDBahanMakanan = "BM01")
WHERE IDBahanMakanan = "BM01" ;
错误信息返回
Error Code: 1093. You can't specify target table 'bahanmakanan' for update in FROM clause