Philip Warner <[EMAIL PROTECTED]> writes:
> This will work, but will not solve the larger problem of 'give me all the
> attrs of of the record with the least datetime for a given SID'. Jeff does
> not need this, but it is a common problem. Simply using min/max works for
> one attr, but fails to pr
At 17:19 27/07/01 -0700, Josh Berkus wrote:
>Phillip,
>
>> What it effectively does is executes the second SELECT for each row
>> of the
>> first select, a bit like a column-select expression, but it allows
>> access
>> to all rows.
>
>Ah! I knew that there had to be a simple way to do what you w
Phillip,
> What it effectively does is executes the second SELECT for each row
> of the
> first select, a bit like a column-select expression, but it allows
> access
> to all rows.
Ah! I knew that there had to be a simple way to do what you want to do
in PGSQL:
SELECT MIN(getfile) as bestfile
At 11:47 27/07/01 +1000, Philip Warner wrote:
>
>...the FROM statement would be a lot nicer if your had a table of SIDs, or
>at least had a good way of generating the list of SIDs.
>
A final (& possibly best) option, is:
Select
MDT.GETFILE,
[anything else from 'best' rec
A way to do this is:
Select GETFILE From
(Select Min(DATETIME),SID From LOGS Group by SID) as MDT,
LOGS L
Where
L.SID = MDT.SID
And L.DATETIME = MDT.DATETIME
But this fails if there are more than one row for a given SID/DATETIME pair
(doe you have a unique
Yeah I have been having a bit of a problem expressing myself in terms of
this query, sorry about that.
What I need is:
SELECT getfile FROM logs (and a restriction that results in finding the rows
with the lowest datetime for each unique sid)
To define this table a bit more:
Logs table has a pr