Is there any way in Mysql to query a string inside another string?
ECHO
ECHO 2020-01-02 10:44:28
0
5
999

Mysql Is there any way to query? For example, the string '3,5' is within the string '3,4,5,2'

The situation is probably like this

How many users are there? An attribute, the attribute ID is stored in a field in the user table

For example, user_attr, the value storage format is: '3,4,5,2',

Explanation: For example, numbers are attributes ID

Now the front end needs to query �%9

ECHO
ECHO

reply all(4)
孤独是一种态度

find_in_set() Learn more

lk

like correct answer

junwind

There is no need to use sql query here. Convert 3,5 passed from the front end into array [3,5], and then 3,4,5,2 are also converted into arrays. Compare them to know whether they are in it.

余水

Convert 3 and 5 into arrays, loop and splice where conditions, user_attr like '%3%' or user_attr like '%5%' groug by user id? Maybe the efficiency is not that high, it can be achieved

  • reply If you use like, you can’t tell the difference between 3,13 5,15.
    ECHO author 2020-01-04 16:00:36
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template