FIND_IN_SET() doesn't return the number of elements in a list, it just returns the position of a specific value, if it is found.
One expression you can use to calculate the length of a list is:
LENGTH(ads.categories)-LENGTH(REPLACE(ads.categories, ',', ''))+1
The difference in the length of the string and the string with commas removed, plus on, is the number of elements.
But you will find storing data as a comma-separated list when you really want to treat the elements individually is going to cause more problems.
It'll be much easier if you represent this many-to-many relationship between ads and categories by creating a third table to store each pair of ads.id
and ads_category.id
.