02-28-2010, 07:39 PM
|
#3 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Quote:
|
Originally Posted by unitechy
My project is not related to wordpress, Wordpress was supposed to be an example. AFAIK
Code:
SHOW TABLES FROM `database_name`
displays the tables? But can I use WHERE clause in it? If yes how?
|
I hope you don't mind me cross posting this back into the forums, but it's useful for others to see the problem and possible solutions.
You can use a WHERE clause in a show tables statement, however you may be more interested in LIKE, ie
mysql Code:
SHOW TABLES FROM `database` LIKE 'table%'
However this will just display a list of the table names, and with your naming conventions, will actually list all of them. You may want to consider using the information_schema database for this;
mysql Code:
USE information_schema; SELECT TABLE_NAME FROM `tables` WHERE SUBSTR(TABLE_NAME, -1) < 4;
|
|
|
|