我遇到一個使用ANY查詢的小問題。Mysql任何不等於子查詢不起作用
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
中只有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;
從那裏我添加了任何和查詢運行,但似乎忽略!=。我猜我在這裏錯過了一些東西。
感謝
什麼數據類型是'date_parsed'列?條件'date_parsed = 05121'看起來很奇怪。如果這是一個日期條件是不正確的,如果它是一個數字的前導零不相關,並且如果它是一個字符列,那麼你需要把它括在單引號。 – 2013-05-12 12:40:09
@a_horse_with_no_name date_parsed無關緊要。 (這是int btw)。 – TheEditor 2013-05-12 12:43:08