update prodlist
set price=a.salary,date=a.begindate
from
(
select salary,pxid,max(begindate) as begindate from prodgx group by salary,pxid
)a
where prodlist.pxid=a.pxid

解决方案 »

  1.   

    update prodlist
    set price= (select min(salary) 
                from prodgx T
               where begindate = (select max(begindate) 
                                    from prodgx 
                                   where pxid = T.pxid)
                                         and prodlist.pxid = T.pxid)
        ,[date]=(select max(begindate) 
                   from prodgx 
                  where pxid = prodlist.pxid)
      

  2.   

    to  Myyokel(庄稼人): a 表示表prodgx吗?
      

  3.   

    update prodlist 
     set price = A.salary, 
         date = A.begindate
     from prodgx as A
      where prodlist.pxid = A.pxid 
        and A.begindate = (select max(begindate) from prodgx where id = A.id)
      

  4.   

    update prodlist 
     set price = a.salary, 
         [date] = a.begindate
     from prodgx a inner join prodlist b
      on a.pxid = b.pxid 
        and a.begindate = (select max(begindate) from prodgx where id = a.id)
      

  5.   

    UPDATE prodgx INNER JOIN prodlist ON prodgx.pxid = prodlist.pxid SET prodlist.price = Max(prodgx.salary), prodlist.[date] = Max([begindate]);
      

  6.   

    如果有脏数据:
    =(select max(begindate) from prodgx where id = a.id) 的记录可能多条
      

  7.   

    update prodlist 
     set price = a.salary, 
         [date] = a.begindate
     from prodgx a inner join prodlist b
      on a.pxid = b.pxid 
        and a.begindate = (select max(begindate) from prodgx where id = a.id)