排除验证两个条件的记录

Shr*_*uti 6 sql sql-server select

select * from table_name
 where BaseDocEntry=15 and BaseDocType='PRRH' and ItemCode='TestStudy2'
   and WhseCode='01' and (currentdoctype<>'PUSH' and CurrentDocEntry<>15)
Run Code Online (Sandbox Code Playgroud)

根据我上面写的查询,来自INS2的数据将被取出,不包括currentdoctype [PUSH]和CurrentDocEntry不是15的所有数据.我期望我的查询是,它必须排除数据,只有这个组合,即currentdoctype = PUSH和CurrentDocEntry = 15发生在同一行,然后排除该行.

你能解决这个问题吗?

Den*_*ret 17

用这个:

and not (currentdoctype='PUSH' and CurrentDocEntry=15)
Run Code Online (Sandbox Code Playgroud)