Justin Kelley
Justin Kelley

Reputation: 107

Create New SQL Column With Smaller Buckets (Based on Text, not Numbers)

I have a column in SQL that has multiple "Definitions" but I would like anything that starts with DEF to just be the generic "Definition".

What can I put in my Select statement to have this converted?

Desired Output

Upvotes: 0

Views: 38

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270021

You can use case:

select (case when current_output like 'DEF%' then 'DEFINITION'
             else current_output
        end) as desired_output

Upvotes: 4

Related Questions