mysqli - Duplicate Temporary Table MySQL -


i want reference temporary table multiple times in same query. due problem temporary tables cannot that:

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

so fix i'm creating duplicates of temporary table:

create temporary table if not exists earnings_temp_one (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_two (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_three (select * earnings earning_account_id = ?); 

but requires me query massive table earnings 3 times, extent defeats purpose.

is there way me duplicate temporary table, under different name?

then run query on massive table once.

or maybe there's fix temporary table problem doesn't require me create duplicates?

ok, solved it:

create temporary table if not exists earnings_temp_one (select * earnings earning_account_id = ?); create temporary table if not exists earnings_temp_two (select * earnings_temp_one); create temporary table if not exists earnings_temp_three (select * earnings_temp_one); 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -