Subject Re: Timestamp differences
Author mspencewasunavailable
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@...> wrote:
>
> Michael,
>
>
> What is the Query Plan?

PLAN SORT (JOIN (B INDEX (IDX_TSTAMP), T INDEX (PK_SSNT)))
PLAN JOIN (A INDEX (IDX_TSTAMP), S INDEX (PK_SSNT))

>
> > Here's the query:
> >
> > select a.id, s.SSN, CAST(a.tstamp AS TIME) as "Created",
> > cast(((select first 1 b.tstamp from dq b join SSNT t
> > on b.SSN_ID = t.SSN_ID
> > and b.TSTAMP between a.TSTAMP and a.TSTAMP + .007
> > and t.TID = 'D'
> > and b.DIR = 'I'
> > where b.id <> a.id order by b.id ) - a.TSTAMP) * 86400
> > as numeric(8,3)) as "Interval" from dq a join SSNT s
> > on a.SSN_ID = s.SSN_ID
> > where a.TSTAMP between '16-dec-2008 18:00' and '16-dec-2008 19:30'
> > and s.TID = 'D'
> > and a.DIR = 'I'
> >
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>
> Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
> Anywhere, MySQL, InterBase, NexusDB and Firebird!
>
> Database questions? Check the forum:
> http://www.databasedevelopmentforum.com
>