Subject Re: Nested Joins or Temp Tables
Author karolbieniaszewski
--- In firebird-support@yahoogroups.com, Paul Lopez <paul.lopez@...> wrote:
>
> Hi,
>
> > Hey. FB Newb here. Come from strictly a SQL Server background. I am
> > attempting to optimize some queries and procedures by either
> >
> > A) Creating a temp table, inserting key values from a small set of records,
> > then using the temp table as my initial join for child tables
> >
> > or
> >
> > B) Using a nested select (derived table) to essentially do the same thing
> >
> > I can not seem to find anywhere online whether this is even supported and if
> > it is, the correct syntax. We are using FB 1.5.
> >
> > Any help is greatly appreciated.
> > JP
> >
>
> We regularly do this...
>
> Select t.fielda, d.fieldb <-- this gets the t2.fieldb
> From sometable t
> Join ( // derived table
> Select t2.fieldb, t2.fieldc as fieldx
> From anothertable t2
> Where somecondition=true
> ) d on d.fieldx = t.fieldy
> Where otherconditions=true
>
> Hope this helps.
>
> Paul.
>

Paul this is not supported in FB1.5

but "gymbratjodee" you must tell how you get this small set of records
is this some search criteria and can go into where clause? Or this is something else
In FB2 and above you can do many thinks - derived tables, tem tables, execute block ..

Karol Bieniaszewski