MySQL Forums
Forum List  »  Newbie

Re: SELECT FROM ALL TABLES / dinamic query with concat and prepare.
Posted by: Phillip Ward
Date: April 17, 2018 04:42AM

You don't have to fully automate everything. That's complicated.

Run this in mysql:

select 'insert into big_table select * from ' || table_name as query 
from information_schema.tables 
where table_schema = 'ftth_cpe_history' 
order by 1 ;

That will give you a big slab of output that you can then cut and paste back into mysql to execute it. There may even be a way of suppressing the column delimiters around the output, to make life easier still.

Regards, Phill W.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.