如何查询包含一定数量的记录?

时间:2012-11-19 22:22:50

标签: mysql sql

已编辑:如何查询包含特定号码的记录,USING REGEXP?

数据库:

id | number
1 | ["5","8","9","19","1"]
2 | ["2","3","8","11","10"]
3 | ["1","14","3","22","15"]
4 | ["20","8","4","6","7"]
5 | ["3","9","14","20","10"]

在sql中,如何只查询编号为8的记录? (Id的1,2和4)

1 个答案:

答案 0 :(得分:2)

您没有告诉我们数据类型是什么,所以我认为它是文本。

Select * from mytable
Where number like '%"8"%'