LIKE Operator to assign value using CASE
I am trying to analyze a plain-text field that is several sentences, pull out keywords and assign that keyword as the "Reason" (in a new column). The goal is to avoid using multiple query tables to do so.
This is what I came up with, and seems to almost work, however when looking at the results, the assigned value in "Reason" does not match any keyword in "Timecard Comments". If there is no matching keyword, the field should return blank.
--
SELECT
"Billed","Timecard Comments",
CASE "Timecard Comments"
WHEN "Timecard Comments" LIKE '%Notice%' THEN 'Notice'
WHEN "Timecard Comments" LIKE'%Inspection%' THEN 'Inspection'
WHEN "Timecard Comments" LIKE '%Rent%' THEN 'Rent Collection'
WHEN "Timecard Comments" LIKE '%Keys%' THEN 'Keys'
WHEN "Timecard Comments" LIKE '%Warranty%' THEN 'Warranty'
ELSE NULL
END AS 'Reason'
FROM "Timecards"