Why are you contorting yourself into just one query?

Your last clause would be a complete table scan seems to me.  Sounds slow 
versus 2 queries.

Why can't you just do this? (pseudo code here) -- no table scans involved at 
all.

select docid from b where t match 'blah';
if (rowcount > 0) // the we have a b so check for a
  mydocid=result
  select docid from a where docid=mydocid;
  if (rowcount > 0) // then a has the same docid
    mydocid=result
  end
else // no b exists so a is the only potential one
  select docid from a where t match 'blah';
  mydocid=result
end


Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to