1 Reply Latest reply on Apr 13, 2018 10:55 AM by Eric Hammond

    CUSTOM SQL - WHERE not working properly, Order of Ops?

    Stephen Groff

      SELECT EVENT_NO, SER_PFX, SER_NO, PD_ID, CUZ_AREA_ID, CUZ_AREA_DESC, DISC_AREA_ID, DISC_AREA_DESC, EVENT_DESC, EVENT_TS, CMPNT_SERIAL_NO,EVENT_CAT_ID_NO, EVENT_CID_DESC_TXT,

      ASGN_TO, RPR_MIN, FAC_PROD_FAM_CD, EXT_CPY_STAT, PROTOTYPE_IND, NEW_FOUND_MISSED, DISPO_CD, QUALITY_VELOCITY, WAIT_TIME

       

      FROM some.table

       

      WHERE (DISC_AREA_ID<>'501' OR DISC_AREA_ID<>'525' OR DISC_AREA_ID<>'600' OR DISC_AREA_ID<>'700' OR DISC_AREA_ID<>'701' OR DISC_AREA_ID<>'702'

      OR DISC_AREA_ID<>'703' OR DISC_AREA_ID<>'704' OR DISC_AREA_ID<>'705' OR DISC_AREA_ID<>'706' OR DISC_AREA_ID<>'800' OR DISC_AREA_ID<>'900')

      AND

      (FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP' OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')

       

       

      They won't work together.

      The blue one won't work on its own (red removed)

      The red one will work on its own (blue removed)

       

      Above all else, I'd like to get these to work together.. I have a couple of more to add on the end... but I think my order of ops is screwed up.

       

      If you know how to simply this, then by all means... please educate me.  This is only my first day using SQL.

       

      Thank you PROs!