我得到下面的错误为下面的SQL查询,我很确定它有给PostGl别名有关。我只是不知道如何纠正它。
查询:
all = 'SELECT Master_Sub_Account , cAccountTypeDescription , Debit , Credit FROM [Kyle].[dbo].[PostGL] AS genLedger'
'Inner JOIN [Kyle].[dbo].[Accounts] '
'on Accounts.AccountLink = genLedger.AccountLink '
'Inner JOIN [Kyle].[dbo].[_etblGLAccountTypes] as AccountTypes '
'on Accounts.iAccountType = AccountTypes.idGLAccountType'
' WHERE genLedger.AccountLink not in (161,162,163,164,165,166,167,168,122)'
错误:
多部分标识符"genLedger.AccountLink"不能被束缚。(4104)
at where子句不是有效的SQL语法:
WHERE genLedger.AccountLink <> 161 OR genLedger.AccountLink <> 162 OR...
,但你可以用not in
代替:
WHERE genLedger.AccountLink not in (161,162,163,164,165,166,167,168,122)