cancel
Showing results for 
Search instead for 
Did you mean: 

AND OR statements not working for my query.

Former Member
0 Kudos

Hi All,

I need some modifications in my original query but I seem to cannot run it properly.

Please see details below:

Original Query:

QRY_Filter_Inactive.PAYMENT_METHODS LIKE '%I%' AND QRY_Filter_Inactive.BANK_COUNTRY IS NOT NULL and not QRY_Filter_Inactive.MASTER_SOURCE in ('MDS_161' 'MDS_162') AND not QRY_Filter_Inactive.ACCOUNT_GROUP IN ('0002')

New Requirement:

•Rule should not be applied if the Account group is Z007 and the vendor is extended to CN01, CN02, CN03, CN04, CN05, CN08 or IN01

My Query:

QRY_Filter_Inactive.PAYMENT_METHODS LIKE '%I%' AND QRY_Filter_Inactive.BANK_COUNTRY IS NOT NULL and not QRY_Filter_Inactive.MASTER_SOURCE in ('MDS_161','MDS_162')

AND (QRY_Filter_Inactive.ACCOUNT_GROUP <> '0002' OR (QRY_Filter_Inactive.ACCOUNT_GROUP = 'Z007' AND not (QRY_Filter_Inactive.COMPANY_CODES like '%CN0%' OR QRY_Filter_Inactive.COMPANY_CODES like '%IN01%')))

Can anybody spot an issue with my new query? I am in a dead end for this query. I would like to add a new condition where it will exclude all records that have an account group 'Z007' and Company Codes like %CN0% or like %IN01%.

Any help will be greatly appreciated.

Thanks in advance,

Nicolo

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member187605
Active Contributor
0 Kudos

QRY_Filter_Inactive.PAYMENT_METHODS LIKE '%I%'

AND QRY_Filter_Inactive.BANK_COUNTRY IS NOT NULL

and not QRY_Filter_Inactive.MASTER_SOURCE in ('MDS_161' 'MDS_162')

AND not QRY_Filter_Inactive.ACCOUNT_GROUP IN ('0002')

and not (QRY_Filter_Inactive.ACCOUNT_GROUP = 'Z007' and QRY_Filter_Inactive.COMPANY_CODES in ('CN01', 'CN02', 'CN03', 'CN04', 'CN05', 'CN08', 'IN01'))