2

たとえば、次のようなテーブルがあります。

ID | 名前 |
--------------------
1 | T | T |
2 | テキスト |
3 | あ |
4 | Text1 と Text |
5 | テキスト |

、そして、次のような文字列と一致する列を逆にしたい:

select * from table_name where %name% like 'Text1 and Text2 and Text3' 

、およびこれらの結果を取得するには:

ID | 名前 |
-----------
1 | T | T |
2 | テキスト |
4 | Text1 と Text |

それはどのように可能ですか?

4

1 に答える 1

3

試す:

SELECT *
FROM table_name
WHERE 'Text1 and Text2 and Text3' LIKE '%'||name||'%'

UPDこれが私のSQLFiddleの例です:SQLFiddle

于 2012-12-07T13:27:51.967 に答える