循环更新语句怎么写?
seima 2003-07-08 03:09:12 下列语句能否用一个语句表示?
update sjtj set sjks=a.imin, sjjx=b.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '11%' )
update sjtj set sjks=b.imin, sjjx=b.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '12%' )
update sjtj set sjks=c.imin, sjjx=c.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '21%' )
update sjtj set sjks=d, sjjx=d.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '22%' )
update sjtj set sjks=e.imin, sjjx=e.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '31%' )
update sjtj set sjks=f.imin, sjjx=f.imax
from sjtj (select min(sjbh),max(sjbh) from CXGZ
where sjbh like '32%' )