possible to create sql query with table wildcards?

Posted by Rees on Stack Overflow See other posts from Stack Overflow or by Rees
Published on 2010-03-09T10:15:41Z Indexed on 2010/03/09 10:21 UTC
Read the original article Hit count: 351

Filed under:

this is probably a simple question, but i have been unable to find a solution online, any help would be much appreciated.

I'm trying to create an SQL query in PHP and would like to somehow apply a wild card to the TABLE filter... something perhaps like.... select * from %table%. However, I have only so far been able to see filters for column values not table names.

as an example i would have tables such as:

jan_table_1 feb_table_1 jan_table_2 feb_table_2

and would want to say, select only tables with a "jan" prefix... or "1" suffix.

Is there a quick and easy solution to this that I have not seen? Thanks in advance!

© Stack Overflow or respective owner

Related posts about sql