You can't post-process a table which is locked for deletion. using the hack select * from (query) as Nicola states will generate a temporary table instead of direct access.
Edit - make sure that you give ID to the tables you use since it is nested and will require uniqueID for every table.