yzx99

导航

 
寫出以下SQL語句
update O10YSSK set YGGH=t4.em_code
from O10YSSK t1 inner join
(select distinct t1.em_no,max(t1.i_date) as RQ0
 from code_no_tab t1 inner join O10YSSK t2
 on t1.em_no=t2.YGKH and t2.RQ>=t1.i_date and t2.RQ='2005-02-28' group by t1.em_no) t3
on t1.YGKH=t3.em_no and t1.RQ>=t3.RQ0 inner join code_no_tab t4
on t1.YGKH=t4.em_no and t3.RQ0=t4.i_date and t1.RQ='2005-02-28'
結果分析一直都有錯誤
Server: Msg 107, Level 16, State 2, Line 2
The column prefix 't3' does not match with a table name or alias name used in the query.

後來把update O10YSSK set 改為 update t1 set就可以了。真奇怪!
posted on 2005-06-03 16:43  yzx99  阅读(808)  评论(0编辑  收藏  举报