2014-09-04 141 views
0

你好,我正在嘗試使用select語句進行更新。 這裏是我的代碼SQL查詢選擇並更新

update recolha_hrs_2014 r set r.state = 'porval' from (select e.sigla from dgrhe_entidade e) where r.state = 'finalizado' and r.qzp = '10' and e.sigla = '145014'

但是它給了我一個錯誤。 錯誤:FROM中的子查詢必須有別名 LINE 3:from(從dgrhe_entidade e選擇e.sigla)

任何建議。我究竟做錯了什麼?

希望你能幫助我 謝謝,

回答

0

試試這個:

update r 
set set r.state = 'porval' 
from recolha_hrs_2014 r 
inner join dgrhe_entidade e on e.??? = r.???? 
where r.state = 'finalizado' and r.qzp = '10' and e.sigla = '145014' 

我不知道哪場(收費)dgrhe_entidade地圖recolha_hrs_2014,但是這就是需要去: 「e。= r。」