MySQL reports an error when executing multi-table query: [SQL] SELECT * from ( select e.account from employee e UNION SELECT u.account from `user` u UNION SELECT a.account from agent a ) [Err] 1248 - Every derived table must have its own alias This means that each derived table must have its own alias. This error usually occurs when querying multiple tables or subqueries. In a nested query, the result of the subquery is used as a derived table for querying the upper level, so the result of the subquery must have an alias. In the above example, modify the query statement: SELECT * from ( select e.account from employee e UNION SELECT u.account from `user` u UNION SELECT a.account from agent a )as total As shown above, adding a sentence as total after the subquery is equivalent to giving the derived table of the subquery result set an alias of total, and the problem is solved. You may also be interested in:
|
<<: js date and time formatting method example
>>: Solve the problem of Linux FTP anonymous upload and download starting automatically
I have been working on a project recently - Budou ...
This article describes how to configure a seconda...
1. Overview of viewport Mobile browsers usually r...
The specific code for sending emoticons in the vu...
To search for RocketMQ images, you can search on ...
MySQL software installation and database basics a...
Table of contents 1. Literals 1.1 Numeric literal...
#mysql -uroot -p Enter password mysql> show fu...
Table of contents 1. Panorama II. Background 1. R...
When using Oracle database for fuzzy query, The c...
There was no problem connecting to the database y...
In the process of using Vue to develop projects, ...
Table of contents 1. Introduction 2. On-demand at...
We know that in general, a function must be calle...
Table of contents Overview Virtual Dom principle ...