SELECT items from a databasefield divided by a comma
something I have been struggling with.
I have a tablefield in a database where I store multiple numbers, divided by a comma.
E.G. = TBL1 - Numberfield has (1,2,3,4,5,6,7,8,9,10,11,12)
HOW can I show all rows from TBL1 where the Numberfield has 1 in it.
What i have rightnow works, but when I select 1, I also select 11, 12, ... how do I avoid this !
my code example:
WHERE (tbl1.Numberfield LIKE '%'开发者_如何学编程 + @Numberfield + '%')
Ty for the help and your time !
It's best to change your schema, but you can try this with your current schema:
WHERE (',' + tbl1.Numberfield + ',' LIKE '%,' + @Numberfield + ',%')
精彩评论