Reputation: 13682
I need to find a way to search all columns along these lines:
select CASE
When substr(column,1,7) = 'Report:' then substr(column,8)
when substr(column,1,5) = 'Print' then substr(column, 6)
else column
end
from table
Any help on syntax and what not would be greatly appreciated!
Upvotes: 0
Views: 55
Reputation: 24124
Edit column when selected based on content
Are you looking for this?
UPDATE table
SET
column =
CASE
WHEN substr(column,1,7) = 'Report:' THEN substr(column,8)
WHEN substr(column,1,5) = 'Print' THEN substr(column, 6)
ELSE column
END
WHERE <conditions>
Upvotes: 1