2009/12/3 Yuzem <naujnit...@gmail.com>:
>
> Thanks both for the replies.
.
.
.
.
> SimonDavies wrote:
>>
>> SELECT a.id,a.title,a.rating,tag.tag FROM (movies natural left join
>> user) as a natural left join tag;
>>
> It doesn't work, it says: no such column a.id
> If I use movies.id I have the same problem as before: movies with no rating
> don't get any tags.
>

This is what I see:

C:\>sqlite3 yuzem.db
SQLite version 3.4.2
Enter ".help" for instructions
sqlite>
sqlite>
sqlite> create table movies( id integer primary key, title text );
sqlite> insert into movies( title ) values( 'movie1' );
sqlite> insert into movies( title ) values( 'movie2' );
sqlite> insert into movies( title ) values( 'movie3' );
sqlite>
sqlite> create table user( id integer primary key, rating text );
sqlite> insert into user( rating ) values( 'rating1' );
sqlite> insert into user( rating ) values( 'rating2' );
sqlite>
sqlite> create table tag( id integer primary key, tag text );
sqlite> insert into tag( tag ) values( 'tag1' );
sqlite> insert into tag( tag ) values( 'tag2' );
sqlite> insert into tag( tag ) values( 'tag3' );
sqlite>
sqlite> SELECT a.id,a.title,a.rating,tag.tag FROM (movies natural left join user
) as a natural left join tag;
1|movie1|rating1|tag1
2|movie2|rating2|tag2
3|movie3||tag3
sqlite>

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

Reply via email to