mmmosias — 2012-12-21T21:08:49-05:00 — #1
What is the way to write a SELECT statement to retrieve data from several tables with the same name pattern. I'd like to select data from these tables: table_2012, table_2013, table_2014... I only want the tables that have the prefix (e.g. table_) and exactly the four characters for the year. I don't want tables that have a different pattern than the year. Is this doable in MySQL? What is the
SELECT * FROM TABLE LIKE table_% WHERE ....
felgall — 2012-12-21T22:45:40-05:00 — #2
No it isn't. The table name is the one value that must be hard coded in every SQL command (other than the SQL keywords of course).
snowball18 — 2012-12-23T16:47:55-05:00 — #3
Felgal is right...
You should use multiple queries joined on a UNION statement...
Sent from my GT-I5800