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

Best Answer

  • GrantSmith
    GrantSmith Indiana 🔴
    Accepted Answer

    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

Answers