> Apparently, SQLite always executes the join before evaluating other
> conditions.
> 
> Try something like this:
> 
> SELECT *
> FROM Big INNER JOIN Small ON Big.ID = Small.BigID
> UNION ALL
> SELECT *, NULL, NULL, ...
> FROM Big
> WHERE NOT flag
> 

This is indeed a nice solution! 
But unfortunately not for my problem :(
I am using index to sort rows from Big table (In case of UNION sorting will be 
too expensive).
Seems like the only solution is to use 

SELECT ..., CASE WHEN Flag (...subselect from Small...) OR NULL END, ... FROM 
Big ORDER BY sort_idx DESC;

Anyway, thank you for help! 

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

Reply via email to