Mysql FIND_IN_SET usage, mysqlfind_in_set

Source: Internet
Author: User

Mysql FIND_IN_SET usage, mysqlfind_in_set

In mysql, FIND_IN_SET is used to determine whether a string contains a comma.

For example

SELECT t. group_id, COUNT (group_id) tsumFROM (SELECT group_id FROM xx WHERE FIND_IN_SET (openid, 'Expect, oarwerrr-2KRah_TklJEomljhlKg, oaSiouEgtr5t5utLFU8-evmkn5BwQ3_c ') AND user_uuid = 'xxxxxxxxxxxxxx') tGROUP BY group_id;
In this way, we can find the matching data.

The latter is a character with a comma


In java, how does one pass the find_in_set keyword to query mysql?

It can be fully used in java, as long as you pass in a string and use commas to separate it.
 
Can the first mysql find_in_set parameter be multiple values?

FIND_IN_SET (str, strlist)
If the str string is in the strlist consisting of N substrings, the return value ranges from 1 to N. A string list is a string consisting of several tokens separated by commas. If the first parameter is a constant string and the second parameter is the type SET column, the FIND_IN_SET () function is optimized and computed in bits. If str is not in strlist or strlist is a null string, the return value is 0. If any parameter is NULL, the return value is NULL. This function cannot run normally when the first parameter contains a comma.

This function cannot run normally when the first parameter contains a comma.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.