Ok, here's one. Either its impossible, or someone might
be able to point me to the light.
Given:
* A table TABLE_DESC, which is rather like a system table,
in that it contains the names and column_names of other tables.
* A table MY_TABLE, which contains "ordinary" data, and has a set
of rows in TABLE_DESC.
What I wish to do is to do
SELECT MY_TABLE.*
but without knowing that the name of the table is "MY_TABLE" in advance
of submitting the query to the db, but rather discovering its name
from TABLE_DESC in the same query.
Perhaps this can be done with some combination of setting variables
within a function or procedure, and views, but I haven't been able
to work out a way to do it yet.
The minimal
set @tname := (SELECT table_name FROM table_desc WHERE id = :id);
SELECT * FROM @tname;
certainly doesn't work....although @tname does contain the expected value.
Playing games with subqueries has been equally unsuccessful.
Thanks in advance.
Michael
--
Michael Fischer Happiness is a config option.
michael@visv.net Recompile and be happy.