Re: [sqlite] Problems with max(datestamp) in subquery

2009-08-17 Thread Leo Freitag
David Bicking-2 wrote: > > As written, you were selecting any record with the correct date > regardless of Ensemble or Steuck. > > David > The following seem to work: SELECT * FROM tblZO_Haupt AS hpt WHERE hpt.zo_tblEnsemble = AND hpt.zo_tblStueck = ... AND hpt.datum = ( SELECT

Re: [sqlite] Problems with max(datestamp) in subquery

2009-08-12 Thread Leo Freitag
P Kishor-3 wrote: > > On Mon, Aug 10, 2009 at 2:25 PM, Leo Freitag<leofrei...@netcologne.de> > wrote: > > sqlite> SELECT * FROM haupt WHERE datestamp = (SELECT Max(datestamp) > FROM haupt WHERE "group" = 1 AND song = 1); > 3|1|2|1|11|2009-08-04 >

[sqlite] Problems with max(datestamp) in subquery

2009-08-10 Thread Leo Freitag
Hello, in table haupt I store information about group, singer, song, voice and datestamp. [CODE] CREATE TABLE 'haupt' ('id' INTEGER PRIMARY KEY, 'group' INTEGER, 'singer' INTEGER, 'song' INTEGER, 'voice' INTEGER, 'datestamp' TEXT); INSERT INTO "haupt" VALUES(1, 1, 1, 1, 11, '2009-08-01');

Re: [sqlite] Select on foreign key NULL

2009-05-26 Thread Leo Freitag
Thanks a lot. Both works fine. Leo John Machin schrieb: > On 27/05/2009 1:09 AM, Leo Freitag wrote: > >> Hallo, >> >> I got some problems with a select on a foreign key with value null. >> I want to filter all male singers. >> >> CREATE TABLE 'tblsing

[sqlite] Select on foreign key NULL

2009-05-26 Thread Leo Freitag
Hallo, I got some problems with a select on a foreign key with value null. I want to filter all male singers. CREATE TABLE 'tblsinger' ('id' INTEGER PRIMARY KEY, 'name' TEXT, 'fkvoice' INTEGER, 'sex' TEXT); INSERT INTO "tblsinger" VALUES(1,'Anna Netrebko',1, 'f'); INSERT INTO "tblsinger"

Re: [sqlite] Simple Outer Join question?

2009-05-26 Thread Leo Freitag
Mon, 25 May 2009 23:14:50 +0200, Leo Freitag >> <leofrei...@netcologne.de> wrote: >> >>> I have a table 'person' and a table 'group'. Every person can join >>> none, one or more groups. >>> No I want to select all persons except those who are member i

[sqlite] Simple Outer Join question?

2009-05-25 Thread Leo Freitag
Hallo, I have a table 'person' and a table 'group'. Every person can join none, one or more groups. No I want to select all persons except those who are member in group 1. - Sounds simple, but not for me. Thanks in advance Leo ___ sqlite-users

Re: [sqlite] Combining .output and .read in a batch file

2009-05-07 Thread Leo Freitag
Slightly modified it works: === batchfile REM the read-statement with quotes sqlite3 test.db ".read r1.sql" === r1.sql REM the following line without quotes .output o1.txt select * from table1; Thanks a lot. Leo Simon Davies schrieb: > 2009/5/7 Leo Freitag <leofrei.

Re: [sqlite] Combining .output and .read in a batch file

2009-05-07 Thread Leo Freitag
Yes, that's what I wanted to do. But even with that syntax there is no output. Any other ideas? Leo Pavel Ivanov schrieb: > Maybe you want to do > sqlite3 test.db ".output o.txt; .read r.sql" > > Pavel > > On Thu, May 7, 2009 at 6:44 AM, Leo Freitag <

[sqlite] Combining .output and .read in a batch file

2009-05-07 Thread Leo Freitag
Hallo, I try to get run the following in a batch file Open database "test.db" Set output to "o.txt" Read sql-statement form "r.sql" === r.sql - Start === select * from table1; === r.sql - End === Thinks like the following didn't work: sqlite3 test.db .output o.txt .read r.sql Thanks for your

[sqlite] Error on INSERT with SELECT Max(id) FROM ...

2009-02-24 Thread Leo Freitag
Hallo, I'm trying to insert the highest value of tblName into tblZO. There fore I followed the hints in this article ... http://www.nabble.com/How-to-use-the-ROWID-of-the-last-inserted-row-for-FK-insert-into-other-tables--td19085514.html#a19085514 ... but I got a error (see below) SQLite