嗨,我会想要获得比包含我的字符串参数之一的行。我的字符串为:“一,二,三”。我想从表中获取包含该字符串元素的所有数据的光标(例如,我的查找字符串是我的字符串“rock,is,dead”,我想获取该字段包含的行:“rock”。请帮助我,谢谢
问问题
459 次
1 回答
2
SELECT * FROM Your_Table WHERE 'rock,is,dead' LIKE '%' || String_Column || '%'
For more efficient lookups, you need to split up your search string so that the words can be checked individually, which allows the database to use index lookups (if you have an index):
SELECT * FROM Your_Table WHERE String_Column IN ('rock', 'is', 'dead')
(Please note that plain comparisons, unlike LIKE
, are case sensitive, unless you use a different collation.)
于 2013-08-12T14:20:41.807 回答