Steve Castellotti wrote:
> SELECT name FROM (SELECT table_name FROM media WHERE media_id=1);
You can try something like:
SELECT name FROM audio JOIN media ON id
WHERE table_name='audio' AND media_id=1
UNION ALL
SELECT name FROM video JOIN media ON id
WHERE table_name='video' AND media_id=1
;
Assuming you've got indexes on (id) on both tables that should be
reasonably quick.
--
Richard Huxton
Archonet Ltd