mysql query must have derived a problem alias record

Recently doing mysql sql compatible, turned out to be the oracle sql must ensure that in the mysql database to run
business scenario: The original is a child with a sql query in oracle can be normal operation, moved to mysql discovered the error, the error message Such as:

Every derived table must have its own alias

This error means that the derived query results must have an alias, such as SQL:

select * from (select a.id , a.name from A)  limit 0,1

or

select count(1) from (select a.id , a.name from A)  

Etc. oracle queries are normal, but will be in the mysql error, the solution is to add the individual sub-query name

select * from (select a.id , a.name from A) t  limit 0,1

or

select count(1) from (select a.id , a.name from A)  t

ok, after adding individual names, sql appeal can be normal operation, mysql and oracle syntax similarities and differences can refer to my previous blog: https://blog.csdn.net/u014427391/article/details/87307903

Guess you like

Origin www.cnblogs.com/mzq123/p/11470605.html