公告
财富商城
积分规则
提问
发文
2019-02-11 23:58发布
地球回转人心会变
!FIND_IN_SET('needle', haystack)
It seems to do not work if the field is NULL and therefore doesn't contain the value.
So I wrote the following workaround:
WHERE id NOT IN (SELECT id FROM table WHERE FIND_IN_SET(needle,haystack))
Hope it'll help!
FIND_IN_SET returns the index of the match if it is found, and returns 0 if it is not found. Since 0 is FALSE you can just use NOT FIND_IN_SET('needle', 'haystack')
FIND_IN_SET
NOT FIND_IN_SET('needle', 'haystack')
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set
FIND_IN_SET('needle', haystack) = 0 should do the trick.
FIND_IN_SET('needle', haystack) = 0
SELECT id FROM table where !FIND_IN_SET(needle,haystack).......
Its working for me...
最多设置5个标签!
It seems to do not work if the field is NULL and therefore doesn't contain the value.
So I wrote the following workaround:
Hope it'll help!
FIND_IN_SET
returns the index of the match if it is found, and returns 0 if it is not found. Since 0 is FALSE you can just useNOT FIND_IN_SET('needle', 'haystack')
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set
FIND_IN_SET('needle', haystack) = 0
should do the trick.Its working for me...