How to create category based on 1 column

Copper Contributor

Hi all,

I am new to SQL and I am finding a way to categorise 1 column in my table.

 

Currently I have 1 column called ID and I want to add 1 column that determine the category of that ID. My desired out is as following:

 

IDCategory
1a
2b
3a
4a
5b

 

The thing is, for 1 category alone, I have like 50+ ID involved, and I have 20+ categories. How do I create a query to simplify this? Many thanks.

1 Reply
maybe you can do this with stored procedure and function