Member A, Membergroupids: '1,4,123'
Member B, Membergroupids: '12,31'
Looking for '%4%' would give you the correct result, but using '%12%' would also match the '123', and that is not what you want.
Thanks again, Marco. As it turns out in my particular scenario checking for '%12%' worked okay because we don't have any groups with 3-digit numbers. But it is definitely something to keep in mind when checking for single-digit group numbers.