这个SQL语句出了什么问题,我找不到任何错误的
UPDATE Master_Adjust
INNER JOIN [dbo].[Master] ON Master_Adjust.Empno = [dbo].[Master].Empno
SET Master_Adjust.GratuityYtodate = [dbo].[Master].GratuityYtodate,
Master_Adjust.ManualBasicPay = 0,
Master_Adjust.ManualTax = 0,
Master_Adjust.ManualNapsa = 0,
Master_Adjust.ManualPension = 0,
ManualCharity = 0
错误消息
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'INNER'.
答案 0 :(得分:7)
看起来都错了。试试这个:
UPDATE ma
SET ma.GratuityYtodate = [dbo].[Master].GratuityYtodate,
ma.ManualBasicPay = 0,
ma.ManualTax = 0,
ma.ManualNapsa = 0,
ma.ManualPension = 0,
ManualCharity = 0
FROM Master_Adjust as ma
INNER JOIN [dbo].[Master] ON ma.Empno = [dbo].[Master].Empno
答案 1 :(得分:1)
那不是t-sql语法。试试:
UPDATE ma
SET ma.GratuityYtodate = M.GratuityYtodate,
ma.ManualBasicPay = 0,
ma.ManualTax = 0,
ma.ManualNapsa = 0,
ma.ManualPension = 0,
ma.ManualCharity = 0
from Master_Adjust ma
INNER JOIN [dbo].[Master] m ON ma.Empno = M.Empno
答案 2 :(得分:0)
尝试以下查询。
UPDATE [dbo].Master_Adjust
SET
Master_Adjust.GratuityYtodate = [dbo].[Master].GratuityYtodate
,Master_Adjust.ManualBasicPay = 0
,Master_Adjust.ManualTax = 0
,Master_Adjust.ManualNapsa = 0
,Master_Adjust.ManualPension = 0
,ManualCharity = 0
from
[dbo].[Master]
INNER JOIN
[dbo].Master_Adjust
ON
[dbo].Master_Adjust.Empno = [dbo].[Master].Empno