updatedate=(select updatedate from inserted)应该是这句出错了,还有后面的条件也有问题

解决方案 »

  1.   

    update testtop set updatedate=i.updatedate from testtop t join inserted i on  t.username=i.username where updatedate=(select max(updatedate) from testtop t1 where t1.username=t.username)
      

  2.   

    declare @i int,@n varchar(100),@d varchar(100)
    select @n=username, @d=updatedate from inserted
    select @i=max(id) from testtop where username=@n
    update testtop set updatedate=@d where id=@i
      

  3.   

    我要实现的查询是,找出最近一条username=AA的记录,也就是ID=5的那一条!-------------------
    select top 1 from (select * from 表 where username='aa' order by id desc) b
      

  4.   

    该为下面的形式
    update testtop set updatedate=(select updatedate from inserted) 
    where [id]=(select max([id]) from  testtop where username=(select username from inserted))