我想将oracle查询转换为impala。
select name,class,floor
from class.students
where name = 'ted'
and grad ='a'
and rownum<2虽然黑斑鹿不能识别rownum。
我试图在选定的列中使用group by来解决这个问题,但我认为这是不正确的。
另外,rownum作为一个限制,或者它在我们有重复的情况下获取唯一的行?
发布于 2020-12-08 18:42:42
您可以使用limit来模仿oracle rownum。您也可以使用offset来控制行数。Impala limit不能去重,你需要使用distinct去重。还要注意,与oracle不同,Impala首先获取数据,然后应用limit。
select name,class,floor
from class.students
where name = 'ted'
and grad ='a'
limit 2 -- This will show 2 records.https://stackoverflow.com/questions/65195284
复制相似问题