i have this table structure "posts"
+----+-------+---------------+
| id | post | authors_ids |
+----+-------+---------------+
| 1 | test1 | ["1","2"] |
+----+-------+---------------+
| 2 | test2 | ["1","3"] |
+----+-------+---------------+
| 3 | test3 | ["3","4","5"] |
+----+-------+---------------+
what i want to do is to select rows that contains in authors_ids
field a particular value for example i need to select the posts where authors_ids array contains number 4
i know that the table structure is wrong but at this time i will not be able to change it.
how can i achieve that ?
实现此目的的一种快速方法是使用LIKE
进行选择:
SELECT * FROM `posts` WHERE `authors_ids` LIKE '%"4"%';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.