MySQL join with variable table?

From: Date: Tue, 18 Nov 2003 02:00:33 +0000
Subject: MySQL join with variable table?
Groups: php.db 
Request: Send a blank email to php-db+get-31597@lists.php.net to get a copy of this message
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. -- Jason Godesky jason@tribaldawn.com http://www.tribaldawn.com/jason/

« previous php.db (#31597) next »