Skywalker
Skywalker

Reputation: 77

AND NOT LIKE statements together with IN clause?

I want to reduce the size of my SQL. Currently I'm using the following to exclude certain deal_id from it. Basically, there is a separate AND NOT line for each deal_id.

Is it possible to have one line below that will include both deal_id (200001 & 300001)?

I will need to have exactly the same wildcards as below. Can the IN clause be used here or do I need something else?

AND NOT description LIKE '%Error retrieving%Failed%deals deal_id = 200001,%'

AND NOT description LIKE '%Error retrieving%Failed%deals deal_id = 300001,%'

Upvotes: 0

Views: 32

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269793

Use regexp_like():

NOT REGEXP_LIKE(description, 'Error retrieving.*Failed.*deals deal_id = (200001|200001),')

Upvotes: 1

Related Questions