Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-21 Thread dochsm
Thanks to everyone. I have always prefixed table names with the db name when I have attached dbs myself but I didn't appreciate that the temp database was 'attached' as such as well. In a nutshell then, if you only use one database then you can refer to tables with no prefix (although you can p

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-19 Thread Clemens Ladisch
Igor Tandetnik wrote: > On 6/19/2013 8:18 AM, Clemens Ladisch wrote: >> says: >> | If two or more tables in different databases have the same name and >> | the database-name prefix is not used on a table reference, then the >> | table chosen is the one in th

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-19 Thread Igor Tandetnik
On 6/19/2013 8:18 AM, Clemens Ladisch wrote: says: | If two or more tables in different databases have the same name and | the database-name prefix is not used on a table reference, then the | table chosen is the one in the database that was least recently

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-19 Thread Clemens Ladisch
dochsm wrote: > I would have thought having no database prefix would default to the > main says: | If two or more tables in different databases have the same name and | the database-name prefix is not used on a table reference, then the | table chosen is th

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-19 Thread dochsm
That brilliant. It is as I thought. Odd behaviour though. I would have thought having no database prefix would default to the main, after all I don't put the prefix there usually and if you try to create two tables in the same db you get an error (obviously). To be on the safe side I've re-written

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-18 Thread Simon Davies
On 17 June 2013 23:19, dochsm wrote: > I have a table in the main database called 'students' and a two page block of > sql that processes it, referring to it as simply 'students'. > > Experimenting with a different approach, I created a temp table, also called > 'students' that contained a subset

[sqlite] How to select from a temp table with same name as a main table.

2013-06-18 Thread dochsm
I have a table in the main database called 'students' and a two page block of sql that processes it, referring to it as simply 'students'. Experimenting with a different approach, I created a temp table, also called 'students' that contained a subset of the main.students. (I intended to modify th