日期:2014-05-17  浏览次数:20468 次

请大家把这个sql语句帮我解读一下下哈,谢谢哦~
update item ii INNER JOIN lineitem on ii.id=lineitem.itemId set ii.sti=ii.sti+(select SUM(ll.quantity) from lineitem ll where ll.status=3 and ll.itemId=ii.id group by ii.id ) where lineitem.status=3


哪位好心人帮我解读下,这个SQL语句,非常感谢哦~;

我对SQL语句,只是略懂皮毛而已。

THANKS~!

------解决方案--------------------
SQL code

update item ii INNER JOIN lineitem on ii.id=lineitem.itemId set ii.sti=ii.sti+(select SUM(ll.quantity) from lineitem ll where ll.status=3 and ll.itemId=ii.id group by ii.id ) where lineitem.status=3

------解决方案--------------------
探讨

引用:

SQL code

update item ii INNER JOIN lineitem on ii.id=lineitem.itemId set ii.sti=ii.sti+(select SUM(ll.quantity) from lineitem ll where ll.status=3 and ll.itemId=ii.id group by ii.i……

------解决方案--------------------
SQL code

UPDATE ii SET ii.id=ii.id+SUM(li.quantity) FROM item  ii 
INNER JOIN lineitem li ON li.itemId=ii.id
WHERE li.status=3  
GROUP BY li.itemid,ii.id