问题描述
- MySQL错误Every derived table must have its own alias
-
SELECT *
from (select *
from student
where dept_name = 'Comp.Sci.')
natural full outer join
(select *
from takes
where semester = 'Spring' and year = 2009 ) as aa ;到底怎么改 T-T
解决方案
一般在多表查询时,会出现此错误。
因为,进行嵌套查询的时候子查询出来的的结果是作为一个派生表来进行上一级的查询的,所以子查询的结果必须要有一个别名
解决方案二:
SELECT *
from (select *
from student
where dept_name = 'Comp.Sci.') as bb
natural full outer join
(select *
from takes
where semester = 'Spring' and year = 2009 ) as aa ;
在第一个子查询后面设置一个别名就可以了
解决方案三:
Select distinct(LAC_CI) from (Select LAC_CI from dtdb_sh_test
.dt_measurment where callid='04021002ms31310379260576' union Select LAC_CI from dtdb_sh_test
.dt_measurment where callid='04021002ms3131......
答案就在这里:MySQL错误:Every derived table must have its own alias
时间: 2024-12-21 23:53:55