Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は次のようなmysqlテーブル値を持っています
1-2 1-2-3 1-4-5 1-4-5-12-15 15-45-75 1-5-15-25-35-55 55-65-75
5番(15、25、35ではない)の行を選択したい。
LIKEクエリを試しましたが、5つの値すべてに行(15、35、45、55を含む)が含まれています。
SELECT ... WHERE linkage LIKE '%5%'
正規表現でできると思います。手伝ってくれませんか。
これは、 FIND_IN_SETを使用して実行できます。
SELECT ... WHERE FIND_IN_SET(5, REPLACE(linkage,'-',','));
試す
SELECT ... WHERE concat('-',linkage,'-') LIKE '%-5-%'