H
Howard
My question is about ethics and efficiency.
I have a query that process the results of four other queries. All five
perform some calculations ans well as using criteria.
Is it more efficient / faster to hard code these queries as SQL within
the main query or is it better to leave them as separate saved queries
and use them as virtual tables within the main one? (I have to have
separate ones as I cannot perform the final calcs until the sub queries
have each performed their own calcs.)
How many times is a sub query called? If I have something like
SELECT thing FROM SELECT something else FROM table name where...
is the inner query executed just once and then the outer one run on the
result or is the inner one executed once for every result row in the
outer one?
I am in the process of changing all my saved queries into pure SQL that
is then run by db.execute, but I am also working on porting the whole
thing to Delphi and MSSQL where I shall be writing in pure SQL, so am
interested in the best approach to nested SQL.
Howard
I have a query that process the results of four other queries. All five
perform some calculations ans well as using criteria.
Is it more efficient / faster to hard code these queries as SQL within
the main query or is it better to leave them as separate saved queries
and use them as virtual tables within the main one? (I have to have
separate ones as I cannot perform the final calcs until the sub queries
have each performed their own calcs.)
How many times is a sub query called? If I have something like
SELECT thing FROM SELECT something else FROM table name where...
is the inner query executed just once and then the outer one run on the
result or is the inner one executed once for every result row in the
outer one?
I am in the process of changing all my saved queries into pure SQL that
is then run by db.execute, but I am also working on porting the whole
thing to Delphi and MSSQL where I shall be writing in pure SQL, so am
interested in the best approach to nested SQL.
Howard