Select from all tables with same start
How to select all tables who whas fs_ for example, its not a prefix, its a something added from me , but some tables has it, and i want to select all of them, not choasing the o开发者_运维技巧ne by one, but to select all tables who starts with fs_
in your MySQL database you can create an extra column that will contain such value.
ex:
ID | NAME | DATE | FS_COLUMN
1 jon 2011 1
2 doe 2005 0
3 tom 2001 1
Then with PHP you can fetch these rows.
$q = mysql_query("SELECT * FROM table WHERE FS_COLUMN='1'");
$r = mysql_fetch_array($q);
$q = $dbc -> ("SELECT COUNT (*) fs_");
$q -> execute();
$count = $q -> rowCount();
echo $count;
It is hard to tell what you are asking or what you are trying to achieve!?
From what you have said try that, if not then please elaborate your question in a more clear and concise way.
well ... it's really no good design approach but to answer your question:
you will probably want to get all matching tables by
SELECT table_name
FROM information_schema.tables
WHERE table_schema = '___YOUR_DB_NAME___'
AND table_name LIKE 'fa\_%'
and construct your query based on the result
精彩评论