select gid, username from users where FIND_IN_SET(8,gid); //查询gid里含有数字8的记录,gid是varchar ,数据格式:"1,12,8,18,5"select gid, username from users where !FIND_IN_SET(8,gid); //查询gid里不含有数字8的记录,gid是varchar ,数据格式:"1,12,8,18,5"