Posted 09 November 2005 - 07:44 AM
I have a table with columns
Category contains a list of ids so examples are
I am trying to count the number of rows that contain a number in the category ie contain 12 and I expect to get 3 rows but can't get it to work
where category in ('12')
only returns 1 but
where category like '%12%' returns 4
I'm stuck, please help.
Posted 09 November 2005 - 07:48 AM
select count(*) from `clients` where `category` like '%,12,%'
Posted 09 November 2005 - 08:15 AM
where category like '%,12,%'
does not work because it doesn't pick up rows where 12 is first number or only number.
Posted 09 November 2005 - 08:25 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users