Skip to content
Advertisement

Can’t UNION ALL on a temporary table?

I’m trying to run the following simple test- creating a temp table, and then UNIONing two different selections:

But get a #1137 - Can't reopen table: 'tmp'

I thought temp tables were supposed to last the session. What’s the problem here?

Advertisement

Answer

This error indicates that the way in which Mysql tables manages the temporary tables has been changed which in turn affects the joins, unions as well as subqueries. To fix mysql error can’t reopen table, try out the following solution:

After this you can perform the union operation.

http://dev.mysql.com/doc/refman/5.0/en/temporary-table-problems.html

http://www.mysqlrepair.org/mysqlrepair/cant-reopen-table.php

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement