On Tuesday 18 November 2003 10:00, Jason Godesky wrote:
> In a MySQL database, I have several tables, including one central table
> that essentially keeps track of the records in the other tables.
>
> TABLE1
> +---------------+---------------+---------------+
>
> |     id        |     str       |     val1      |
>
> +---------------+---------------+---------------+
>
> |   123456789   |   "TABLE2"    |   987654321   |
>
> +---------------+---------------+---------------+
>
> TABLE2
> +---------------+---------------+
>
> |     id        |     val2      |
>
> +---------------+---------------+
>
> |   123456789   | "j00 r0xx0r"  |
>
> +---------------+---------------+
>
> Currently, I'm selecting all the records for a given entry with two SELECT
> statements, one to the central table which gives me the name of the second
> table.  My question is, is there any way to do this in a single query with
> a join?  I suspect not, but I wanted to see if anybody on this list had
> any ideas before I give up on the possibility entirely.

But why are you storing the tablenames in a "central table"? Maybe I'm too 
stupid but I can't see any advantage in doing so. And in doing so you're 
creating that little problem for yourself.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Fashions have done more harm than revolutions.
                -- Victor Hugo
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to