有一个表有code字段有重复数据我要查询出一条就可以了,但其它字段的数据不是重复的。请教如何实现??
如select distinct code ,name from table
name子段是不重复的数据,如果这样写也会判断name是重复的,如何实现查出,一条code和他的name
如select distinct code ,name from table
name子段是不重复的数据,如果这样写也会判断name是重复的,如何实现查出,一条code和他的name
select row_number() over(partition by code order by name) n,code ,name
from table
)
where n=1