Here is a problem which is not working for me in the way I expected. This is the query
SELECT `table_name`
FROM `category`
WHERE `id` = ( SELECT `category_id`
FROM `assets`
WHERE `id` = '24028' )
which is returning the value photos which I need to use as a table name,

from where I need to retrieve final values. So I have used it like this:
SELECT *
FROM (
SELECT `table_name`
FROM `category`
WHERE `id` = ( SELECT `category_id`
FROM `assets`
WHERE `id` = '24028'
)
)
But this returns the error
#1248 - Every derived table must have its own alias
So, have used it like,
SELECT *
FROM (
SELECT `table_name`
FROM `category`
WHERE `id` = ( SELECT `category_id`
FROM `assets`
WHERE `id` = '24028' )
) as `photos`
But again it is returning the same value as in the previous image. But what I am expecting is it should return the value of:
SELECT * FROM `photos`
where photos is the value returned by the subquery.