我在使用 ANY 进行查询时遇到了一个小问题。
Select *, count(*) as m
from mp_bigrams_raw
where date_parsed=051213
and art_source='f'
and bigram != ANY(select feed_source from mp_feed_sources)
group by bigram
order by m DESC
limit 50;
查询运行但不排除在子查询中找到的项目。
当 子查询
中只有 1 行时,原始查询有效。一旦我添加更多,我就会收到关于超过 1 行的错误。
Select *, count(*) as m
from mp_bigrams_raw
where date_parsed=051213
and art_source='f'
and bigram != (select feed_source from mp_feed_sources)
group by bigram
order by m DESC
limit 50;
从那里我添加了 ANY 并且查询运行但似乎忽略了 !=。我猜我在这里遗漏了一些东西。
谢谢
最佳答案
你为什么不使用 NOT IN
Select *, count(*) as m
from mp_bigrams_raw
where date_parsed=051213
and art_source='f'
and bigram NOT IN(select feed_source from mp_feed_sources)
group by bigram
order by m DESC
limit 50;
关于Mysql ANY NOT EQUAL TO 子查询不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16507405/