sql 语句 ,如何取出相同记录中的第一条记录

我想象sql server 中的取记录一样,取出相同集录中的第一条记录。
但是 我不想用 select distinct fld from table . 这种的速度太慢。
. 能不能用 类似 select top 1 fld from table .
或 select forstrow(fld) from table .

---------------------------------------------------------------

如果是低于816的版本
可采用表连接+rowid来实现

如果是816或者以上的ee版本:
select * from
(selec ..., row_number() over(partition by a order by a) rnum from xxx)
where rnum = 1;

partition by 后面的字段组合能唯一区分一条记录

Published At
Categories with 数据库类
comments powered by Disqus