David542
David542

Reputation: 110572

SUBSTRING_INDEX this or that

How would I do the following:

SELECT SUBSTRING_INDEX(log, 'Basic/urn:' OR 'Basic/urh:', -1)

In other words, I want to split on two different strings.

Upvotes: 0

Views: 35

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271151

I am guessing you just want this:

SELECT SUBSTRING_INDEX(log,
                       (CASE WHEN log like '%Basic/urn:%' THEN 'Basic/urn:' ELSE 'Basic/urh:',
                       -1)

Upvotes: 1

Related Questions