6
select * from table_name
 where BaseDocEntry=15 and BaseDocType='PRRH' and ItemCode='TestStudy2'
   and WhseCode='01' and (currentdoctype<>'PUSH' and CurrentDocEntry<>15)

上記のクエリによると、INS2 からのデータは、currentdoctype [PUSH] と CurrentDocEntry が 15 ではないすべてのデータを除いてフェッチされます。 currentdoctype=PUSH と CurrentDocEntry=15 が同じ行で発生している場合、その行を除外します。

このクエリを修正できますか?

4

3 に答える 3

22

これを使って:

and not (currentdoctype='PUSH' and CurrentDocEntry=15)
于 2012-05-21T10:34:59.137 に答える
1

currentdoctype が「PUSH」と異なり、CurrentDocEntry が 15 と異なる場合、クエリは除外されANDます。OR

currentdoctype=PUSH および CurrentDocEntry=15 が必要な場合は、代わりにこれらの条件を入力してください。

select * from ins2
where BaseDocEntry=15 and BaseDocType='PRRH' and ItemCode='TestStudy2'
and WhseCode='01' and (currentdoctype='PUSH' and CurrentDocEntry=15)
于 2012-05-21T10:36:43.957 に答える