您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

sql 查询复数据并显示语句

2025/10/17 8:47:56发布16次查看
sql 查询复数据并显示语句
sql 查询复数据并显示语句
//方法二
select name,content,imgurl,synois from (
select name,content,imgurl,synopsis ,row_number() over (partition by name order by content) as rn
from table1
) t where t.rn=1
//方法二
if object_id('[tb]') is not null drop table [tb]
create table [tb]([name] varchar(1),[content] varchar(5),[imgurl] varchar(5),[synopsis] varchar(6))
insert [tb]
select 'a','不同1','不同1','可不填' union all
select 'a','不同2','不同2','可不填' union all
select 'a','不同3','不同3','可不填' union all
select 'b','不同4','不同4','可不填' union all
select 'b','不同5','不同5','可不填' union all
select 'c','不同6','不同6','可不填'
select * from [tb]
with tt
as(
select id = row_number() over (partition by name order by name ),* from tb )
select  [name], [content], imgurl, synopsis from tt where id  = 1
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product