2012-11-19 65 views
-5

編輯:如何查詢包含特定號碼的記錄,使用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)

+0

什麼數據類型是你的號碼字段? –

回答

2

你不告訴我們什麼數據類型的數字,所以我認爲它是文本。

Select * from mytable 
Where number like '%"8"%' 
相關問題