日期:2014-05-16  浏览次数:20765 次

语句错误 求大神解决
Select * From (Select RowNum As RN,tmptable.* From (Select * From employee Where 1=1 and (Memo is null or Memo='') Order by NAME) tmptable Where RowNum<11) Where rn>=1;
有什么问题呢??
报错误  
Every derived table must have its own alias
该怎么修改呢?

------解决方案--------------------
Select * From 
(
Select RowNum As RN,tmptable.* From 
(Select * From employee Where 1=1 and (Memo is null or Memo='') Order by NAME) tmptable Where RowNum<11) A Where rn>=1;
------解决方案--------------------
must have its own alias


Select * From 
(
Select RowNum As RN,tmptable.* 
From (Select * 
From employee 
Where 1=1 and (Memo is null or Memo='') 
Order by NAME) tmptable 
Where RowNum<11
) T

Where rn>=1;
------解决方案--------------------
Every derived table must have its own alias

MYSQL中必须加个别名。
Select * From (Select RowNum As RN,tmptable.* From (Select * From employee Where 1=1 and (Memo is null or Memo='') Order by NAME) t tmptable Where RowNum<11) Where rn>=1;
------解决方案--------------------
SQL code
Select * From 
(Select RowNum As RN,tmptable.* From 
(Select * From employee Where 1=1 and (Memo is null or Memo='') Order by NAME tmptable 
Where RowNum<11)a
Where rn>=1;