Home

How to fix "Every derived table must have its own alias?"

Alton Alexander
By Alton AlexanderUpdated on June 4th, 2022

A derived table is a table that is created from the result of a query. It is temporary and does not exist on its own. A derived table must have its own alias in order to be identified. This error code happens because the query is trying to reference a table that does not exist.

Other common searches for this error include:

  • error code: 1248. every derived table must have its own alias
  • every derived table must have its own alias

1. Add an alias to each derived table in the query

  1. Go to the Query Editor and open the query.
  2. On the toolbar, click the Alias button.
  3. In the Alias dialog box, type the alias for the table you want to add an alias to.
  4. Click OK.
  5. Repeat steps 2-4 for each table you want to add an alias to.

2. Use a CTE (Common Table Expression) for each derived table

  1. In the query editor, create a CTE named "Derived Tables"
  2. In the Derived Tables CTE, select the tables to be fixed and alias them.
  3. In the "Select columns" list, select the columns to be fixed and alias them.
  4. In the "Select expressions" list, select the expressions to be used to fix the columns.
  5. Click "Fix columns" to fix the columns.

3. Convert each derived table to a subquery in the FROM clause

In the example, the derived table "Employees" must have an alias "Emp", so the following steps must be followed:

  1. In the FROM clause, replace "Employees" with "Emp".
  2. In the SELECT clause, replace "Emp" with "Employees".
  3. In the WHERE clause, replace "Emp" with "Employees."

4. Use a view for each derived table

  1. In the application's main menu, select File > New > View.
  2. Enter the name of the derived table in the Name text box.
  3. In the Table Properties dialog, select the Derived Table check box.
  4. In the Alias text box, enter the name of the derived table's alias.
  5. Click OK.
  6. In the application's main menu, select File > Save As.
  7. In the Save As dialog, enter the name of the view file in the File name text box.
  8. Click Save.