sh1122
sh1122

Reputation: 1

Proper way to use <> with multiple values?

When using <> or =! to exclude mulitple values for a report is the correct format between the different values "OR"? I figured that using the table the value is from between the two would help but I seem to still be pulling in values for discontinued items. I tried two different configurations with the same results

example:

o.OrderStatusCode <> ('DISC') OR o.OrderStatusCode <> ('CANC')

I tried this configuration also

o.orderstatusCode <> ('DISC', 'CANC")

neither of them gave me the results needed- DISC values still showed on the report. Any advice on what I am doing wrong?

Upvotes: 0

Views: 28

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269933

You want not in:

o.orderstatusCode not in ('DISC', 'CANC')

However, the logical equivalent with <> uses AND, not OR:

o.orderstatusCode <> 'DISC' and o.orderstatusCode <> 'CANC'

Otherwise, your code always evaluates to TRUE (or NULL) because one of the conditions is always true -- if the code is 'DISC' then the logic is FALSE OR TRUE.

Upvotes: 3

Related Questions