Search code examples
oracle-databasepeoplesoft

Filter on column except when certain condition in a different column


I am a little new to Oracle and PeopleSoft but this is my issue.

I need to filter some rows out of a database based on a couple column conditions, but if these conditions meet a different condition in a separate column they should still be included. Here is what I have so far:

SELECT * FROM PS_SAA_ACRSE_AVLVW 
WHERE CATALOG_NBR NOT LIKE '%000%' AND CATALOG_NBR NOT LIKE '%900%'

This works fine, but if the CATALOG_NBR IS '900' AND SUBJECT column is 'SAA' any of these should be included.

Hopefully this makes sense.


Solution

  • what about OR ?

    SELECT * FROM PS_SAA_ACRSE_AVLVW 
    WHERE ( CATALOG_NBR NOT LIKE '%000%' AND CATALOG_NBR NOT LIKE '%900%' )
       OR ( CATALOG_NBR = '900' AND SUBJECT_column = 'SAA')