If using "natural left join" is not a requirement for you then this
works as you expect it:
select movies.id, title, rating, tag
from movies left join user on movies.id = user.id
left join tag on movies.id = tag.id;
Pavel
On Thu, Dec 3, 2009 at 9:49 AM, Yuzem <[email protected]> wrote:
>
> Lets say I have the following tables:
> movies: id,title
> user: id,rating
> tag: id,tag
>
> I want to left join all three tables:
> SELECT movies.id,movies.title,user.rating,tag.tag
> FROM movies natural left join user natural left join tag
>
> The problem with this besides having to specify the tables (instead of
> doing: select id,title,rating,tag) is that if a movie doesn't have any
> rating it will not retrieve any tag neither. The table tag is joined to the
> table user not to the main table movies
>
> The following works as expected but it is terribly slow:
> SELECT id,title,rating,tag
> FROM movies natural left join (movies natural left join user) natural left
> join (movies natural left join tag)
>
> Is there any way to get the last result with an acceptable speed?
> --
> View this message in context:
> http://old.nabble.com/Multiples-natural-left-joins-problem-tp26627140p26627140.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users