MySQL Forums
Forum List  »  Newbie

Re: Is it Possible to concat result from show tables with a query?
Posted by: Francisco Pastrana
Date: August 01, 2014 07:45AM

Hi!

Thanks for the tips!

Ok first, the tables are separated by year because only the 2012 table have 25 million rows and 2013 was 25.6 millions so I think it was time to do that separation.

Quote

you could do something querying information_schema and building the query

Very inspirational

select concat('select date_p from ',table_name,' group by date_p')
from information_schema.tables
where table_schema = 'commercial'
and table_name like 'b2b%'

Ok, it's not perfect but works for me, the average time of the result is 0.28 seconds, I receive the querys I need and then in jsp I do the rest just to create something like this


query1
union
query2
union
query3
union
etc...

And the drop box returns all the dates available, when I create a new table naturally, the result set will give me another select with the new table.

Thank you Again!

Options: ReplyQuote


Subject
Written By
Posted
Re: Is it Possible to concat result from show tables with a query?
August 01, 2014 07:45AM


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.