Subject RE: [firebird-support] Nested Joins or Temp Tables
Author Paul Lopez

> 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.