我对使用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;
查询正在运行,但不排除子查询中找到的项。
当
subquery
中只有一行时,原始查询工作。一旦我添加了更多,我就得到一个关于超过一行的错误。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;
从那里我添加了任何和查询运行,但似乎忽略了!=. 我想我在这里遗漏了什么。
谢谢
最佳答案
为什么不使用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;