Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Reply
Highlighted
Yellow Belt

Providing a True/False(Y/N) if text in a comma separated string is in a separate column

Hello,

 

I have data that looks like this and the goal is to validate if the order season is in the selling season.  I tried like but it didn't seem to be consistent.   Any help would be appreciated.

Order SeasonSelling SeasonsGoal
18SP18SP,18SU,18FA,19SPY
19FA18SP,18SU,18FA,19SPN
18FA18SP,18SU,18FA,19SPY
20SP18SP,18SU,18FA,19SPN

 

Thank you,

 

DMJerry


Accepted Solutions
Highlighted
Red Belt

Do you have an example of your like statement or how it wasn't consistent?

 

Like should work to determine if the order season is in your selling season CSV string.

 

CASE
WHEN `Selling Seasons` like CONCAT('%', `Order Season`, '%') THEN
'Y'
ELSE
'N'
END


**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post


All Replies
Highlighted
Red Belt

Do you have an example of your like statement or how it wasn't consistent?

 

Like should work to determine if the order season is in your selling season CSV string.

 

CASE
WHEN `Selling Seasons` like CONCAT('%', `Order Season`, '%') THEN
'Y'
ELSE
'N'
END


**Was this post helpful? Click the heart icon**

**Did this solve your problem? Accept it as a solution!**

View solution in original post

Highlighted
Yellow Belt

Thank you!  The concat was the key that I missed.  Appreciate it sir!

Announcements
Domopalooza 2021 Call for Presenters: We want to hear how Domo is revolutionizing the way you do business!

Click here to submit your story.