Igor Tandetnik wrote:
> How about this:
>
> select A.*, B.*
> from TBOOKING A, TBOOKING B
> where A.EVENTTYPE = 3 and B.ID = (
> select min(C.ID) from TBOOKING C
> where C.EVENTTYPE = 4 and C.ID > A.ID
> );
>
> Igor Tandetnik
Igor, you are my hero ;-)
I've tried a subselect in the join
Griggs, Donald <[EMAIL PROTECTED]>
wrote:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> On Behalf Of Ingo Koch Sent: Monday, November 03, 2008 2:15 PM
>> SELECT t.*, u.*
>> FROM TBOOKING AS t LEFT JOIN TBOOKING as u ON t.ID+1=u.ID WHERE
>> t.EVENTTYPE+1=u.EVEN
Griggs, Donald wrote:
> When you wrote: "... but I didn't want to keep track of an additional
> ID in the application but instead let the database do the work."
>
> I don't think I understand what logic the database is supposed to use to
> determine this. If you were talking to a database that
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ingo Koch
Sent: Monday, November 03, 2008 2:15 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Subselect question
Csaba wrote:
> Firstly, perhaps you should be linking the start
Csaba wrote:
> Firstly, perhaps you should be linking the start and stop event across
> a common id rather than relying on a start and stop appearing as
> consecutive entries. Without knowing more about where your database
> comes from it's hard to say.
>
> If you insist on keeping the current st
>> Here is some test data:
>> -
>> CREATE TABLE "TBOOKING" (
>> "ID" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
>> "EVENTTIMESTAMP" TIMESTAMP NOT NULL,
>> "EVENTTYPE" INTEGER NOT NULL,
>> "EMPLOYEE" INTEGER);
>>
>> INSERT INTO "TBOOKING" VALUES(42,'2008-09-22 09:19:
On Nov 3, 2008, at 6:39 AM, Ingo Koch wrote:
> Hi,
>
> I've got a question concerning a query with subselects.
> I have a table with stores pairs of events. one of the events is
> kind of a start event and the other one is a stop event.
> Each event is stored in its own row. What I'm trying to ac
Firstly, perhaps you should be linking the start and stop event across
a common id rather than relying on a start and stop appearing as
consecutive entries. Without knowing more about where your database
comes from it's hard to say.
If you insist on keeping the current structure, here's a way to
Hi,
I've got a question concerning a query with subselects.
I have a table with stores pairs of events. one of the events is
kind of a start event and the other one is a stop event.
Each event is stored in its own row. What I'm trying to achive is to
get a view which contains rows with the start e
On Jul 9, 2008, at 3:23 PM, Shawn Wilsher wrote:
> Hey all,
>
> Quick (and hopefully simple) question regarding subselects in a where
> clause. Does sqlite cache the values of a subselect so it doesn't
> have to run the query each time it evaluates a row?
>
> Example:
> SELECT *
> FROM foo
> WHE
Hey all,
Quick (and hopefully simple) question regarding subselects in a where
clause. Does sqlite cache the values of a subselect so it doesn't
have to run the query each time it evaluates a row?
Example:
SELECT *
FROM foo
WHERE id NOT IN (SELECT id FROM bar)
Cheers,
Shawn
___
11 matches
Mail list logo