update Salary_Pay_Detail set book_value = T.tax
from
T
where 
salary_employee_id = (select id from Salary_Employee where employee_id = T.employee_id and salary_Apply_Id = @appid)
and book_id = '0307' 
and salary_employee_id in (select id from Salary_Employee where salary_Apply_Id = @appid)这个T是一个 复杂的sql select 出来的结果集主要是这个 
update set from where 这种语句怎么理解

解决方案 »

  1.   


    update Salary_Pay_Detail set book_value = T.tax
    from Salary_Pay_Detail join
    T
    on
    salary_employee_id = (select id from Salary_Employee where employee_id = T.employee_id and salary_Apply_Id = @appid)
    and book_id = '0307' 
    and salary_employee_id in (select id from Salary_Employee where salary_Apply_Id = @appid)
    一样的意思
      

  2.   

    谢谢回答
    那转成oracle的怎么写啊
      

  3.   

    ORACLE的update 语法是 Update t1 set a=(select m from t2 where t1.id=t2.id_1)  where exists (select 1  from t2 where t1.id=t2.id_1 )