22,210
社区成员
发帖
与我相关
我的任务
分享
;with t
as
(
select field4,fgbno,row_number() over (order by fgbno,outbarcode) as rownum
FROM FGB_INNERBAR
where fgbno in
(
select fgbno from fgb_pick_mstr
where itmcode=(select itmcode from fgb_pick_mstr where fgbno='LCB1306004856' )
)
)
update t
set field4= rownum
WHERE fgbno ='LCB1306004856'
[/quote]
刚刚试了下,可以用
还有没有其他的语句呢,你应该是看我语句来写的吧,文字估计没看懂[/quote]
呵呵,对的,我就看了语句。
你的意思是后面报错是吧,之所以报错,是因为对于update FGB_INNERBAR 要更新的一条记录,在子查询中,也就是在row_number 中返回了多余一条记录,所以报错的;with t
as
(
select field4,fgbno,row_number() over (order by fgbno,outbarcode) as rownum
FROM FGB_INNERBAR
where fgbno in
(
select fgbno from fgb_pick_mstr
where itmcode=(select itmcode from fgb_pick_mstr where fgbno='LCB1306004856' )
)
)
update t
set field4= rownum
WHERE fgbno ='LCB1306004856'
[/quote]
刚刚试了下,可以用
还有没有其他的语句呢,你应该是看我语句来写的吧,文字估计没看懂;with t
as
(
select field4,fgbno,row_number() over (order by fgbno,outbarcode) as rownum
FROM FGB_INNERBAR
where fgbno in
(
select fgbno from fgb_pick_mstr
where itmcode=(select itmcode from fgb_pick_mstr where fgbno='LCB1306004856' )
)
)
update t
set field4= rownum
WHERE fgbno ='LCB1306004856'
update FGB_INNERBAR
set field4=
(
select COUNT(*)
FROM FGB_INNERBAR
where fgbno in
(
select fgbno from fgb_pick_mstr
where itmcode=(select itmcode from fgb_pick_mstr where fgbno='LCB1306004856' )
)
)
WHERE fgbno ='LCB1306004856'
你的是2000,还是2005