I know what you'll say "that is one terrible design". I know, I have been coping with it for the last couple of months (again, it was not my design), but instead of scalding me, bear with me and help me with the answer, will you? Thanks!
I have a table that has a list of the names of some other tables:
Table_that_store_the_others_tables_names
------------------
| LIST_OF_TABLES |
------------------
| table_arw |
------------------
| table_bhj |
------------------
| table_cde |
------------------
It is important to know that the tables have no common name, but do have the exact same structure:
each_one_of_those_dumb_tables, e.g. table_arw
--------------------------
| field1 | field2 |
--------------------------
| something | something |
--------------------------
| something | something |
--------------------------
So, what I need to do is iterate through such tables and fetch the data they have (I'm pretty sure it is done by procedural language but I don't know much about it) in this some sort of way:
loop through each value found in "Table_that_store_the_others_tables_names":
select field1, field2 from "whatever_value_was_found"
insert into "this_new_not_stupid_table_that_will_now_have_the_info"
end loop
So, I think that's about it. Thank you so much!