<br><br><div class="gmail_quote">On Fri, Sep 4, 2009 at 7:19 PM, Nancy Wichmann <span dir="ltr"><<a href="mailto:nan_wich@bellsouth.net">nan_wich@bellsouth.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Ivan Sergio Borgonovo wrote:<br>
> A better way would be to learn how to query information_schema that<br>
> *should* be portable.<br>
<br>
</div>Well, I don't know about portable, but the MySql manual is wrong in its<br>
comparison.<br>
$list = array();<br>
$result = db_query("SHOW TABLES LIKE 'abc\_%'");<br>
while ($table = db_result($result)) {<br>
$list[] = $table;<br>
}<br>
<br>
Worked just fine. However, to make it work with information_schema required:<br>
$list = array();<br>
$result = db_query("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE<br>
table_name LIKE 'abc\_%'");<br>
while ($table = db_fetch_array($result)) {<br>
$list[] = $table['table_name'];<br>
}<br>
$list = array_unique($list);<br>
sort($list);<br>
<br>
Note that the list had MANY duplicates in it and did not come out in order<br>
of table name.<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br>This is plain SQL, and hence there is nothing stopping you from using DISTINCT as well as ORDER BY, like any other SQL. It should be portable between MySQL and PostgreSQL.<br>
</div></div>-- <br>Khalid M. Baheyeldin<br><a href="http://2bits.com">2bits.com</a>, Inc.<br><a href="http://2bits.com">http://2bits.com</a><br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>
Simplicity is the ultimate sophistication. -- Leonardo da Vinci<br>