PDA

View Full Version : how to refer to a virtual table created by sub-query in other sub-query?


mr_raik
11-24-2008, 06:44 AM
hello all, i have a problem:
how to refer to a virtual table created by sub-query in other sub-query?
like this:

select ... FROM (select....) as C where xyz=(select ...from C) ..;

it returned error table C does not exist :confused:

Fumigator
11-24-2008, 05:17 PM
Just re-state the temporary table select in your second subquery.


select ... FROM (select....) as C where xyz=(select ...from (select same temptable as before....)) ..;

mr_raik
11-25-2008, 03:47 PM
Just re-state the temporary table select in your second subquery.


select ... FROM (select....) as C where xyz=(select ...from (select same temptable as before....)) ..;


the query command will be long and complicated.
is there any other way than doing like this?

Fumigator
11-25-2008, 08:07 PM
The query is long and complicated anyway. You're being too picky. :p