0

Query Help with NOT IN

Okay, so I am trying to select 'new' answers that aren't in my database. So I am trying the following query.

select * from answers.search(10) where query='sea doo' and type='resolved' and id not in ('20100511213900AAKJAZh', '20100115121459AAc40PZ', '20080521151500AAktYAA', '20070611162352AAiIT16', '20090614192238AAxt5mg', '20100809184830AAdCIKc', '20090819001143AARZGTq', '20100614111230AADOytO', '20090819201130AADub2i', '20070729210735AA8MXBE')

this returns nothing, but if i change answers.search(10) to 20. it returns 10 good results. Problem is i cannot just double up the count because it is limited to 50.

Is there a way to select 10 (or more, the count varies with my functions) where the id not in the id list?

it seems like what it is doing is because those 10 questions are the first to be returned with that keyword it ignores them because of the NOT IN statement. with normal SQL it will keep going until it finds 10 unique questions that aren't in the list.

by
1 Reply
  • That is correct. The NOT IN you are using is a local filter, so it is only applied after the results have been fetched from the remote API. Therefore behaves differently than what you are used to from normal SQL.<br><br>Also see:&nbsp;http://developer.yahoo.com/yql/guide/filters.html#local_filters<br><br><div class="quote "><div class="quotetop ">QUOTE<cite>(Shaun McCudden @ 30 Jul 2011 2:47 PM)</cite><blockquote class="quotemain"><br>it seems like what it is doing is because those 10 questions are the first to be returned with that keyword it ignores them because of the NOT IN statement. with normal SQL it will keep going until it finds 10 unique questions that&nbsp;aren&#39;t&nbsp;in the list.</blockquote></div></div>
    0

Recent Posts

in YQL