Re: [sqlite] Help with SQL and index (or schema?)

2009-03-29 Thread Jonas Sandman
> In the sub-SELECT you use * so you get all columns. That's > not necessary. > Ah, thanks! > It might be better to rewrite as a self-join using LEFT > OUTER JOIN on filename and filepath, using an NULL istarget > from one or the other alias as an indication that target > instance of the file is

Re: [sqlite] Help with SQL and index (or schema?)

2009-03-27 Thread Kees Nuyt
On Fri, 27 Mar 2009 18:08:13 +0100, Kees Nuyt wrote: > PRIMARY KEY (filepathid,filename,istarget) Oops, make that PRIMARY KEY (pathid,filename,istarget) -- ( Kees Nuyt ) c[_] ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite

Re: [sqlite] Help with SQL and index (or schema?)

2009-03-27 Thread Kees Nuyt
On Fri, 27 Mar 2009 15:53:18 +0100, Jonas Sandman wrote: >Hello, > >I have a database with about 137000 * 2 rows with four columns; >fileid, filename, filepath and istarget. >It's used to determine if two scanned directories are equal so I run a >simply query to get the rows that are missing on t

[sqlite] Help with SQL and index (or schema?)

2009-03-27 Thread Jonas Sandman
Hello, I have a database with about 137000 * 2 rows with four columns; fileid, filename, filepath and istarget. It's used to determine if two scanned directories are equal so I run a simply query to get the rows that are missing on the target directory but do exists in the source directory. I use

Re: [sqlite] help with SQL

2008-08-30 Thread Greg Morphis
It's not liking the "as" ... this works more or less.. select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, b.payeeid, b.iscc, b.isactive, p2.payeeid, p2.amount, case p2.amount when '' then 0 else sum(amount) end as amount, case p2.payments when null then 0 else 1 end as paid, payments fro

[sqlite] help with SQL

2008-08-30 Thread Greg Morphis
I have this SQL in Postgres and it works fine, I'm trying to port it over to SQLite and having issues.. SQLite doesnt like left outer joining to a subquery.. Can you guys think of a way around this? select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note, b.payeeid, case when p.amount

[sqlite] help with sql query / command SUM

2008-01-13 Thread Jorge Pereira
Hi folks! I Have two tables, and i need access data from both. below it's my tables; CREATE TABLE Product ( CD_PROD INTEGER CONSTRAINT PK_PROD NOT NULL PRIMARY KEY AUTOINCREMENT, CD_REMT_COMM INTEGER CONSTRAINT FK_PROD_REMT_COMM REFERENCES Remote_command(CD_REMT_COMM), CD_IDEN_P

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-13 Thread Dennis Cote
Samuel R. Neff wrote: Still, I think backwards compatibility and consistency with other databases would be most important in this situation. I just checked MSSQL and it's same as current sqlite which uses the first select statement's column names. Samuel, The following is from Oracle's docu

RE: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Samuel R. Neff
2007 11:09 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Help with SQL syntax. Ticket #2296 On 4/12/07, Samuel R. Neff <[EMAIL PROTECTED]> wrote: > > > Wouldn't implementation dependent mean it's not really standardized? The > way I read it the query could still b

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Joe Wilson
--- [EMAIL PROTECTED] wrote: > Consider this query: > >SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY a,b; > > Is the query above equalent to: > > (1) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY 1,2; > > Or is it the same as: > > (2) SELECT a, b FROM t1 UNION S

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Dennis Cote
On 4/12/07, Samuel R. Neff <[EMAIL PROTECTED]> wrote: Wouldn't implementation dependent mean it's not really standardized? The way I read it the query could still be considered legal in some dbms and not in others (which stinks). Samuel, That's not what the standard says. It says the name

RE: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Samuel R. Neff
AIL PROTECTED] -Original Message- From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 6:05 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Help with SQL syntax. Ticket #2296 ... Otherwise, the of the i-th column of TR is implementation dependent and not equival

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Darren Duncan
At 7:22 PM + 4/12/07, [EMAIL PROTECTED] wrote: Consider this query: SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY a,b; Is the query above equalent to: (1) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY 1,2; Or is it the same as: (2) SELECT a, b FROM t1 UNION

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Dennis Cote
[EMAIL PROTECTED] wrote: Consider this query: SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY a,b; Is the query above equalent to: (1) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY 1,2; Or is it the same as: (2) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER

RE: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Samuel R. Neff
ington D.C. metro area. If interested contact [EMAIL PROTECTED] -Original Message- From: Andrew Finkenstadt [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 3:42 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Help with SQL syntax. Ticket #2296 My understanding is: select a, b from

Re: [sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread Andrew Finkenstadt
My understanding is: select a, b from t1 union select b, a from t1 is equivalent to select a as a, b as b from t1 union select b as a, a as b from t1 And therefore, the first sql statement controls the resulting column names, and the order by applies to the column names (transitively) f

[sqlite] Help with SQL syntax. Ticket #2296

2007-04-12 Thread drh
Consider this query: SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY a,b; Is the query above equalent to: (1) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY 1,2; Or is it the same as: (2) SELECT a, b FROM t1 UNION SELECT b, a FROM t1 ORDER BY 2,1; I need to know th

RE: [sqlite] Help with "SQL error: database is locked"

2004-04-16 Thread Juan Romano
, 2004 10:06 AM To: [EMAIL PROTECTED] Subject: RE: [sqlite] Help with "SQL error: database is locked" Hi, I am in the process of porting sqlite (version 2.8.13) to vxworks. I am running into some problems. It seems to work when I invoke the shell with no database (:memory:). I can then cre

RE: [sqlite] Help with "SQL error: database is locked"

2004-04-16 Thread Juan Romano
Hi, I am in the process of porting sqlite (version 2.8.13) to vxworks. I am running into some problems. It seems to work when I invoke the shell with no database (:memory:). I can then create tables, insert records, etc. In general I can submit SQL queries at will. However, when I invoke the shell