Home > Database > Mysql Tutorial > mysqlFIND_IN_SET用法_MySQL

mysqlFIND_IN_SET用法_MySQL

WBOY
Release: 2016-06-01 13:02:07
Original
1181 people have browsed it

mysql 中 FIND_IN_SET 是判断某个字符串是否在带逗号的字符串中

例如

SELECT
  t.group_id,
  COUNT(group_id)    tsum
FROM (SELECT
        group_id
      FROM xx
      WHERE FIND_IN_SET(openid,'qqqwqnfocFq5IL2sXB2Qu0I,oarwerrr-2KRah_TklJEomljhlKg,oaSiouEgtr5t5utLFU8-evmkn5BwQ3_c')
          AND user_uuid = 'xxxxxxxxxxxx') t
GROUP BY group_id;
Copy after login
这样就能找出相匹配的数据

后者是带逗号的字符

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template