I have a column that is a text string that contains a comma separated list of ids. It could look something like this:

> 
> 1,2,3,45,65,23245,564747,23,121,54,65,345678
> 
> 
> 

I need to find if it contains a specific id or not. To get if it just contains a number would be fairly straightforward to do with a regular expression, but the problem is that for example the id 4 is not in the list but of lot of the ids contains a 4. Maybe it's still possible to write a regular expression that can handle that, but that's above my level. Or is there another way to solve this in SQL?

**EDIT**

Just to clarify, I don't actually have a column containing a comma separated list. What I have is a listagg that is made from several rows from a query, and I want to be able to apply a filter to it. I just tried to simplify the question so it would be more focused on the actual problem. I didn't realize that doing this would result in more answers on the database design than on the actual question.