I have a lot of dynamically created nearly similar looking tables according to the scheme "prefix + number", eg "t1", "t2", "t343" etc. All those tables have a cross-table unique row named identifier that I like to select within one query:
SELECT
  `identifier`
FROM
(
  SELECT
    `TABLE_NAME`
  FROM
    information_schema.TABLES
  WHERE
    `TABLE_NAME` LIKE 't%'
);
But this returns: ERROR 1248 (42000): Every derived table must have its own alias
EDIT: according to the comments I modified my query like this:
SELECT
  A.identifier
FROM
(
  SELECT
    `TABLE_NAME` AS identifier
  FROM
    information_schema.TABLES
  WHERE
    `TABLE_NAME` LIKE 't%'
) A;
But this selects only the table names from the subquery but not the column identifier from these tables.
 
    