On 17 June 2013 23:19, dochsm <docshotma...@hotmail.com> 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 of the main.students. (I intended to > modify the sql, replacing 'students' with 'temp.students' but have not yet > done so) > > However, running my original sql now, before editing it, it appears to be > using both the table 'students' and the table temp.students as it is now > repeating some rows. > > Can sombody please explain what might be happening? > If no database prefix is given, doesn't SQLite default to the 'main' > database or does it somehow use a combination of all the tables with the > same name regardless of database?
Does the following output give a clue? SQLite version 3.7.15.1 2012-12-19 20:39:10 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t( data text ); sqlite> create temp table t( data text ); sqlite> insert into t values( 'main' ); sqlite> insert into temp.t values( 'temp' ); sqlite> sqlite> sqlite> select * from t; main temp sqlite> select * from main.t; sqlite> select * from temp.t; main temp sqlite> insert into main.t values( 'really main' ); sqlite> select * from t; main temp sqlite> select * from main.t; really main sqlite> select * from temp.t; main temp sqlite> It looks like the temp db is searched first for a match of table name... Regards, Simon _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users