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.
次のようなテーブルを想像してみてください。
string 12345 1234567 13254 123
1,2,3,4,5を含む行を任意の順序で選択したいだけです。また、さらに短くても、少なくともその中のすべての文字はその「配列」からのものです。
選択された文字列には、これらの文字1、2、3、4、5のみが任意の順序で含まれている可能性があり、それらの文字列は必要ありません。
選択:
12345 123 1324
選択されていない:
123a 1123
頭のてっぺんから.....
SELECT * FROM yourtable WHERE yourcolumn RLIKE '/^([1-5])+$/';
これを試して
SELECT * FROM table_name WHERE column_name RLIKE '^([1-5])+$';