Find other similar articles? A,B,C.

hypothetical articles have a bit called tags that he has finished.
every article has a similar tag, for example,

id / blog_title / tags
1 / Hi / A,B,C
2 /  / A,B
3 /  / C,D

I want to use tags to find other articles that are similar to this article
hypothesis. I am now writing article 1 . Under
, there will be an extension. He will find articles with similar headings like him and show
, so he will show article 2 and article 3
. If you click article 2 , only will be shown. [ID: nbsp; nbsp. Then it will only show article 1 as his extension

SELECT blog_title FROM `blog`
        WHERE tags LIKE "%{ ??? }%"
        LIMIT 3

what function can I use in mysql or php to make this comparison?
is to use the article"s own tag to find other matching tag

Sep.16,2021

I suggest that tags separate a table and then add an intermediate table to maintain the relationship between the article and tags, so that the query and later maintenance will be better


I think the better way is to like, after using explode, but there is no explode method in mysql. You can refer to this article. Create an explode
https://stackoverflow.com/que.
or you can use php as a secondary, explode


SELECT
  blog_title
FROM
  blog
WHERE
  tags RLIKE
  CONCAT('[[:<:]]', REPLACE('A,B,C', ',', '[[:>:]]|[[:<:]]'), '[[:>:]]')

A code B < C, replace it with your parameter placeholder

{?} (I don't know what software uses such a weird placeholder)

[[: <:]] and [[: >:]] denote the boundary of a word , which can be punctuation or the beginning and end of a character.

rlike means regular match.


find_in_set ?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b312a5-2b5c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b312a5-2b5c4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?