If contains statement beast mode

I essentially have a list of URLs in one column and need to extract out the advertiser into a new column. I want to use an if contains statement to search every row in data set and see if it holds the pertaining advertiser name. Below is what I what both columns to look like and the code that I tried. 

 

COL.a     COL.b

url            Advertiser name

 

CASE
WHEN `Page` LIKE '%adCREASIANs%' THEN 'By Gina'
WHEN `Page` LIKE '%Aerovex SystemsInc%' THEN 'Hemp Beauty'
ELSE 'NA'
END;

Best Answer

  • tadashii
    tadashii Member
    Answer ✓

    remove the ; at the end of the syntax 

     

    case when `url` like '%goo%' then 'google'

    when `url` like '%adCREASIANs%' THEN 'By Gina'

    when `url` like '%Aerovex SystemsInc%' THEN 'Hemp Beauty'

    else 'na' end

Answers

  • tadashii
    tadashii Member
    Answer ✓

    remove the ; at the end of the syntax 

     

    case when `url` like '%goo%' then 'google'

    when `url` like '%adCREASIANs%' THEN 'By Gina'

    when `url` like '%Aerovex SystemsInc%' THEN 'Hemp Beauty'

    else 'na' end