【问题标题】:What is the "opposite" of LIKE in sql? [closed]sql中LIKE的“相反”是什么? [关闭]
【发布时间】:2022-12-02 20:26:54
【问题描述】:

I want to do a search in my Database, that gives me the id of all fields, that a given string would contain. So if I have the string \"a, b, c\" and the fields a and b i want them to be shown. Is there an easy way to do it with SQL? My mind seems to be stuck right now.

I could use the LIKE operator on every possible substring of my string or just compare strings without sql, but I\'m hoping for an easier, better solution.

For example: if I have my table like this:

id substring
1 \'hello\'
2 \'two\'
3 \'test\'

And an input-string like: \"hello, this is a test\"

I want to get the information, that my input sentence contains the substrings with the ids 1 and 3

  • Please rephrase your question by showing clear sample input table and the expected output.
  • hey, I geave an example, hope it helps
  • your title and question are two different things. The opposite of LIKE is NOT LIKE but that seems unrelated to your actual question.
  • Just the other way around, where \'hello, this is a test\' like \'%\' || substring || \'%\'

标签: sql search


【解决方案1】:
【解决方案2】:
猜你喜欢
  • 2022-01-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多