简体   繁体   中英

Where clause - Not Like Statement

i got a statement where i got a where clause like this:

AND  (  (ROOT_CAUSE_CODE like 'X%' OR ROOT_CAUSE_CODE like 'D%') AND (SUMMARY_DESC like 'COMPLETE%' or SUMMARY_DESC like 'MULTIPLE%') and SERVICE_LEVEL='TOP' and SERVICE_AFFECTED='1'  ) 

Now i want to create a second query, where i get exactly the opposite of those values of the first where clause. So i will use same statment but with a where clause which gives me all the values not like the first where clause?

How can i achieve that?

THX and BR Joe

If we assume that none of the columns are NULL , then the opposite is:

AND NOT ( (ROOT_CAUSE_CODE like 'X%' OR ROOT_CAUSE_CODE like 'D%') AND
          (SUMMARY_DESC like 'COMPLETE%' or SUMMARY_DESC like 'MULTIPLE%') and
          SERVICE_LEVEL = 'TOP' and SERVICE_AFFECTED = '1'
       ) 

If the values can be NULL than the logic is more complicated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM