此查询假设每次执行时只更新currentStock。但是当我第一次执行查询时,currentStock变为0而不是100.对于我来说,1和2查询都不起作用。
1)
INSERT INTO Store_Items (storeID, itemId,itemName)
VALUES ('STR004', '4534','K40')
ON DUPLICATE KEY UPDATE currentStock = currentStock + 100;
2)
REPLACE INTO Store_Items
SET storeID ='STR004',
itemId='4534',
itemName='K40',
SUM(currentStock) as 'Total',
reorderLevel=1000;