Simon Slavin <slav...@bigfraud.org> writes:

> On 9 Dec 2011, at 10:25pm, Nick Smallbone wrote:
>
>>   select * from a left natural join (select * from b) where id = 1;
>
> Try not to use sub-selects when you can use a JOIN instead.
> Especially don't use them in combination.  If you express this as just
> a JOIN you'll find that the optimizer works as expected.  The reason
> it can't work here is because it can work across JOINs but not
> SELECTs.

This does the trick, of course. The problem is that I am really joining
with a view, i.e.
   select * from a left natural join some_view where id = 1;
so there is no way to avoid a subquery if I want to use the view.

I suppose I will just give up on using a view here, then, and write my
query from scratch instead. Thanks anyway!

Nick

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

Reply via email to