日期:2014-05-16  浏览次数:20645 次

我菜鸟又问问题了,这句代码怎么改啊,怎么没有order by就对了呢
update BUS_PROD_ITEM_SN b set b.ACTION_BY = (select t.ACTION_BY from BUS_PROD_SN_LOG t limit 0,1 order by t.PRODUCT_ITEM_SN_IDX desc);

在mysql里的啊!

------解决方案--------------------
update BUS_PROD_ITEM_SN b set b.ACTION_BY = (select t.ACTION_BY from BUS_PROD_SN_LOG t order by t.PRODUCT_ITEM_SN_IDX desc limit 0,1);
------解决方案--------------------
order by 在 limit 之前。

update BUS_PROD_ITEM_SN b set b.ACTION_BY = (
select t.ACTION_BY from BUS_PROD_SN_LOG t order by t.PRODUCT_ITEM_SN_IDX desc limit 0,1 );
------解决方案--------------------
记住 limit 是放在最后的
------解决方案--------------------
对滴。。要先order by 再limit
------解决方案--------------------
3楼正解
------解决方案--------------------
探讨
order by 在 limit 之前。

update BUS_PROD_ITEM_SN b set b.ACTION_BY = (
select t.ACTION_BY from BUS_PROD_SN_LOG t order by t.PRODUCT_ITEM_SN_IDX desc limit 0,1 );