Home > Article > Backend Development > Requirement: How to find users with similar tags to yourself
Now we are going to make a "guess what you like function". The rules are as follows:
Find people with similar tags to yourself.
The tag field in the database is like this. The tag id is stored, separated by commas (1,2,3 ,4):
Assume that I am 1, 5:
Then I need to find out the labels 1 - 5 -1, 5 -1, 6 -2, 5, 8 (- is the separator)
What if I write a sql statement?
The database is mysql