Subject | Re: Help with query? |
---|---|
Author | Svein Erling Tysvær |
Post date | 2006-07-23T12:10:16Z |
I'd simply do
select MT1.MyTimestamp, MT1.MyVersionNumber, MT1.MyClient,
MT1.MySpeed
from Mytable MT1
where not exists(select * from Mytable MT2
where MT2.MyVersionNumber = MT1.MyVersionNumber
and MT2.MyClient = MT1.MyClient
and MT2.MyTimestamp < MT1.MyTimestamp)
HTH,
Set
select MT1.MyTimestamp, MT1.MyVersionNumber, MT1.MyClient,
MT1.MySpeed
from Mytable MT1
where not exists(select * from Mytable MT2
where MT2.MyVersionNumber = MT1.MyVersionNumber
and MT2.MyClient = MT1.MyClient
and MT2.MyTimestamp < MT1.MyTimestamp)
HTH,
Set
--- In firebird-support@yahoogroups.com, "sbussinger" wrote:
> Take a simple table with 4 columns (Timestamp, VersionNumber,
> Client, Speed) representing clients downloading new versions of
> our software and what download rates they're getting. I'd like a
> query that returns the rows representing the first time each
> client downloaded each version. If a client does not download a
> particular version there would be no rows for those. A client may
> download a version several times but I want only the first of
> those downloads (smallest timestamp). There will be many versions
> of software.
>
> Can anyone help me with this? Thanks!