1

我正在尝试运行此查询。

select *
from (select *
      from student
      where dept_name= ’Comp. Sci’)
      natural left outer join
     (select *
      from takes
      where semester = ’Spring’ and year = 2009);

但每次我得到

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

我尝试为所有派生的表创建别名,但每次都会出现相同的错误。

我该如何解决这个问题。我查找了一些已经回答的问题,但没有运气。

4

2 回答 2

0

尝试这个 :::

select * from 
(select * from student s where dept_name= ’Comp. Sci’) as tempLeft 
left join (select * from takes t where semester = ’Spring’ and year = 2009) on (// join condition)
于 2013-10-04T16:44:47.700 回答
0

为子查询添加别名:

select * 
from 
    (select * from student s where dept_name= 'Comp. Sci') as data1 
    natural left outer join (select * from takes t where semester = 'Spring' and year = 2009) as data2;
于 2013-10-04T16:45:07.790 回答