[sqlite] Why this SQL does not work?

2004-11-11 Thread WeiChin3
Hi, I have two tables: CREATE TABLE A ( ID integer primary key, SERVER_ID integer ) CREATE TABLE B ( ID integer primary key, GROUP_ID integer, SERVER_ID integer ) The following SQL does not work, complaint is Error: no such column: B.GROUP_ID select ID, (select SERVER_ID from A

Re: [sqlite] Why this SQL does not work?

2004-11-11 Thread Gerhard Haering
On Thu, Nov 11, 2004 at 09:40:44AM -0500, [EMAIL PROTECTED] wrote: [...] The following SQL does not work, complaint is Error: no such column: B.GROUP_ID select ID, (select SERVER_ID from A where A.ID=B.GROUP_ID) as GROUP_ID from B [...] Looks like you haven't read this resource, yet:

Re: [sqlite] Why this SQL does not work?

2004-11-11 Thread amead
Gerhard Haering wrote: On Thu, Nov 11, 2004 at 09:40:44AM -0500, [EMAIL PROTECTED] wrote: [...] The following SQL does not work, complaint is Error: no such column: B.GROUP_ID select ID, (select SERVER_ID from A where A.ID=B.GROUP_ID) as GROUP_ID from B [...] Looks like you haven't

Re: [sqlite] Why this SQL does not work?

2004-11-11 Thread Brass Tilde
select ID, (select SERVER_ID from A where A.ID=B.GROUP_ID) as GROUP_ID from B [...] It mentions, among others: Variable subqueries Subqueries must be static. They are evaluated only once. They may not, therefore, refer to variables in the main query. I'm not the

Re: [sqlite] Why this SQL does not work?

2004-11-11 Thread amead
Brass Tilde wrote: select ID, (select SERVER_ID from A where A.ID=B.GROUP_ID) as GROUP_ID from B [...] It mentions, among others: Variable subqueries Subqueries must be static. They are evaluated only once. They may not, therefore, refer to variables in the main

Re: [sqlite] Why this SQL does not work?

2004-11-11 Thread Derrell . Lipman
amead [EMAIL PROTECTED] writes: Brass Tilde wrote: select ID, (select SERVER_ID from A where A.ID=B.GROUP_ID) as GROUP_ID Hmm.. thanks but I'm still confused... isn't the above an example of a non-static query that used variables from the main query? If it uses variables from the main

[sqlite] looking for suggestions to speed up SQL

2004-11-11 Thread Dennis Cote
Hi All, I have a situation where populating data in a temp table takes a long time, about 8 minutes, and I am wondering if anyone can offer any suggestions for ways to speed it up. I have the permanent table and associated index, shown below, which holds tree structured component data. Each node

[sqlite] Any better way to get info about table

2004-11-11 Thread Michael Elfial
Hello, I wonder is there better way to get table column/types information than usage of EXPLAIN especially on empty table. Michael

[sqlite] Any better way to get info about table

2004-11-11 Thread Ishwar . Jasuja
Return Receipt Your [sqlite] Any better way to get info about table document :

Re: [sqlite] looking for suggestions to speed up SQL

2004-11-11 Thread D. Richard Hipp
Dennis Cote wrote: Hi All, I have a situation where populating data in a temp table takes a long time, about 8 minutes, and I am wondering if anyone can offer any suggestions for ways to speed it up. I have the permanent table and associated index, shown below, which holds tree structured

RE: [sqlite] Any better way to get info about table

2004-11-11 Thread Michael Elfial
Thanks! Seems I completely missed some of the pragmas :( -Original Message- From: D. Richard Hipp [mailto:[EMAIL PROTECTED] Sent: Thursday, November 11, 2004 10:36 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Any better way to get info about table Michael Elfial wrote: Hello, I

RE: [sqlite] Any better way to get info about table

2004-11-11 Thread Ishwar . Jasuja
Return Receipt Your RE: [sqlite] Any better way to get info about table document :

[sqlite] .import function

2004-11-11 Thread amead
Maybe I'm blind but I've looked and don't see the answer to this... what is the format for the file to be imported using .import in the sqlite3 CLI database management tool? -Alan

Re: [sqlite] looking for suggestions to speed up SQL

2004-11-11 Thread Dennis Cote
D. Richard Hipp wrote: Dennis Cote wrote: Hi All, I have a situation where populating data in a temp table takes a long time, about 8 minutes, and I am wondering if anyone can offer any suggestions for ways to speed it up. I have the permanent table and associated index, shown below, which

[sqlite] Update multiple columns from subquery

2004-11-11 Thread Peter Bartholdsson
Is there some way to write this query in SQLite? UPDATE groups SET (fileCount, size) = (SELECT count(id), sum(size) FROM files where groupId = 15) WHERE groupId = 15; Or must it be written like this? UPDATE groups SET fileCount = (SELECT count(id) FROM files where

Re: [sqlite] Update multiple columns from subquery

2004-11-11 Thread D. Richard Hipp
Peter Bartholdsson wrote: Is there some way to write this query in SQLite? UPDATE groups SET (fileCount, size) = (SELECT count(id), sum(size) FROM files where groupId = 15) WHERE groupId = 15; Sadly, no. SQLite only allows a subquery to return a single value, not a tuple. --