我想做这样的事情:
SELECT *
FROM
dictionary t1,
dictionary t2
WHERE t1.category <> t2.category
AND t1.tag <> t2.tag
AND t1.word LIKE '% t2.word %';
如何编写'% t2.word %'
部分SQL以获得正确的结果?
答案 0 :(得分:1)
select *
from dictionary t1,
dictionary t2 -- <- Is there an intentional Cartesian Join?
where t1.category <> t2.category and
t1.tag <> t2.tag and
t1.word like '% ' || t2.word || ' %'; -- <- check spaces!
答案 1 :(得分:0)
您需要使用该列。
select *
from dictionary t1, dictionary t2
where t1.category<>t2.category and t1.tag<>t2.tag and t1.word like '% ' + t2.word + ' %';
答案 2 :(得分:0)
select *
from dictionary t1, dictionary t2
where t1.category<>t2.category and t1.tag<>t2.tag and t1.word like '%'+ t2.word +'%';
答案 3 :(得分:0)
这就是你要找的东西:
select *
from dictionary t1, dictionary t2
where t1.category<>t2.category and t1.tag<>t2.tag and t1.word like '% ' + t2.word + ' %';