asp数据库查询,字段值相同的多个记录。
1个回答
展开全部
两种方法,一种是查询重复的数据,只查询重复记录,不管其余信息,如ID什么的:
select uid, time from ztest GROUP BY uid, time having count(*)>1;
查出结果是
uid
time
1
1
还有一种是查询你指定信息,可以查询出ID信息:
select distinct a.id, a.uid, a.time from ztest a join ztest b on a.id != b.id where a.uid = b.uid and a.time = b.time;
查询结果是:
id
uid
time
1
1
1
3
1
1
select uid, time from ztest GROUP BY uid, time having count(*)>1;
查出结果是
uid
time
1
1
还有一种是查询你指定信息,可以查询出ID信息:
select distinct a.id, a.uid, a.time from ztest a join ztest b on a.id != b.id where a.uid = b.uid and a.time = b.time;
查询结果是:
id
uid
time
1
1
1
3
1
1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询