sql server :update b set b.stcdt=a.stcdt from a where b.time='time' and a.scale=b.scaleoracle : update b set b.stcdt=(select stcdt from a where a.scale=b.scale)
where b.time='time'

解决方案 »

  1.   

    sql-server
    要该得是SALE
      

  2.   

    if not exists (select * from b,a  where b.stcdt=a.stcdt and b.time='time')
           insert into b(stcdt,time,sale) Select a.stdct,'time',a.sale from a,b WHERE a.stdct=b.stdct and b.time='time' 
    else
          update b set sale=a.sale  from a,b where a.stcdt=b.stcdt and b.time='time'
      

  3.   

    update a
    set a.sale=b.sale
    from b
    where a.stcdt=b.stcdt and a.time='2002-04-01 08:00:000'写成游标方式他是否等同于DECLARE pa_cursor CURSOR FOR 

    select stcdt,sale from b
    OPEN pa_cursor
    FETCH NEXT FROM pa_cursor INTO @stcdt,@sale
                     
    while @@fetch_status=0
    begin
                    update a       
    set sale=@sale
    where stcdt=@stcdt and time='2002-04-01 08:00:000'      FETCH NEXT FROM pa_cursor INTO @stcdt,@sale
    end
    close       pa_cursor    
    deallocate         pa_cursor