Re: [sqlite] How can I specify that a column is equal to another?

2009-07-01 Thread Dennis Cote
Yuzem wrote: > Is there any way to specify that movies.id is equal to user.id so I can use > just id in my query? > Thanks in advance! > Not with a left join, but with an inner join you can use the USING clause or a NATURAL join. See http://en.wikipedia.org/wiki/Join_(SQL)#Equi-join for more

Re: [sqlite] How can I specify that a column is equal to another?

2009-07-01 Thread Pavel Ivanov
You can do only where movies.id = 'tt0426459' or where user.id = 'tt0426459' What to choose depends on your needs. And you're wrong that these variants are identical and movies.id is always equal to user.id because you're making left join. They will be identical if you will make inner join. But

Re: [sqlite] How can I specify that a column is equal to another?

2009-07-01 Thread Simon Slavin
On 1 Jul 2009, at 5:24pm, Yuzem wrote: > Is there any way to specify that movies.id is equal to user.id so I > can use > just id in my query? I think you have already come up with the two best solutions. You could also create a VIEW http://www.sqlite.org/lang_createview.html and specify

[sqlite] How can I specify that a column is equal to another?

2009-07-01 Thread Yuzem
I have this: select title,my_rating from movies left join user on movies.id = user.id where id = 'tt0426459' The result: ambiguous column name: id I could use: select movies.id ids,title,my_rating from movies left join user on movies.id = user.id where ids =