i try to find %column_name% from another table_name i see the result but he seems to ignore the %%
我试图从另一个table_name中找到%column_name%,但他似乎忽略了%%。
Why it does not work for me?
为什么它对我不起作用?
SELECT column_name FROM table_name WHERE NOT LIKE '%(SELECT column_name FROM table_name)%'
thanks, Apologies if I do not act according to the rules, this is my first question.
谢谢,如果我不按规定办事,这是我的第一个问题。
2 个解决方案
#1
2
Try this:
试试这个:
SELECT column_name FROM table_name WHERE NOT LIKE (SELECT CONCAT('%', column_name, '%') FROM table_name)
You can't just include a query in a string, so put the wildcards next to the column name in a query and return that to the NOT LIKE.
您不能只在字符串中包含查询,因此将通配符放在查询的列名旁边,然后返回给不喜欢的。
#2
0
SELECT column_name
FROM table_name T
WHERE NOT EXISTS ( SELECT column_name from other_table O
WHERE O.column_name LIKE CONCAT('%',T.column_name,'%')
)
#1
2
Try this:
试试这个:
SELECT column_name FROM table_name WHERE NOT LIKE (SELECT CONCAT('%', column_name, '%') FROM table_name)
You can't just include a query in a string, so put the wildcards next to the column name in a query and return that to the NOT LIKE.
您不能只在字符串中包含查询,因此将通配符放在查询的列名旁边,然后返回给不喜欢的。
#2
0
SELECT column_name
FROM table_name T
WHERE NOT EXISTS ( SELECT column_name from other_table O
WHERE O.column_name LIKE CONCAT('%',T.column_name,'%')
)