我试图在mysql中完成一个更新,它只选择最高的导入日期,我似乎无法让它工作。下面的语句更新了这两个价格
UPDATE material, pricelist SET price = '23' WHERE material.id = 1936 AND material.id = pricelist.material_id AND pricelist.import_date = (SELECT max(pricelist.import_date))
y53ybaqx1#
这是你想要的吗?
UPDATE pricelist pl SET pl.price = '23' WHERE pl.material_id = 1936 ORDER BY pl.import_date DESC LIMIT 1;
1条答案
按热度按时间y53ybaqx1#
这是你想要的吗?