i have 3 postgreSQL tables each with different dates stored in schema cm_nokia.
I want to create a view with the content of the table having the most recent date . I used the following query to get me the name of the most recent table
SELECT 
    table_name
    FROM (
        SELECT table_name,
               REGEXP_REPLACE(table_name, '\D', '', 'g') AS table_date
        FROM information_schema.tables
        WHERE table_name LIKE 'umts_cells_%'
    ) AS t
    WHERE table_name = (SELECT table_name FROM (SELECT table_name,
            REGEXP_REPLACE(table_name, '\D', '', 'g') AS table_date
            FROM information_schema.tables
            WHERE table_name LIKE 'umts_cells_%') t2
        ORDER BY table_date DESC
        LIMIT 1) 
and it returned me correct:
i want to dynamically use the result of this query which is "umts_cells_20230427" to put it in a SELECT query  :SELECT * FROM cm_nokia.umts_cells_20230427 but i don't know how to pass the string as a table name in this query.


 
     
    