select distinct
来源:百度知道 编辑:UC知道 时间:2024/05/13 19:26:41
选择所有列a b c,按其中c列的distinct
直接查询似乎没有方法
WHITE_WIN的方法是不行的
比如表中包含
1 2 1
2 2 1
3 1 1
他的查询结果是
3,2,1
可以看出实际表中没有这样的行
nomanland的方法在a列没有重复值的情况下可行,如果有重复值就会出现重复结果
如果允许的话要使用临时表
select a,b,c,identity(int,1,1) as id
into #
from 表
select a,b,c from #
where id in(select max(id) from # group by c)
drop table #
a b 中有没有int 或者datetime类型的?
假设a是int 类型
select * from 表名 where (a in
(select min(a) from 表名 group c))
--------------------------------------------------
沉默用户说的是,我潜意识里直接把a当主键处理了
select a=max(a),b=mac(b),c from table1 group by c
不懂楼主的意思。按楼主的意思是查出来的记录中不存在重复的c?如果一个c对应了多个a和b,那么选出哪一条记录?
select distinct
select distinct 问题
select distinct ModuleName,PtNo from T_PtModule
请教数据库查询集 select 中的distinct问题
ACCESS里的 SELECT DISTINCT (不出现重复问题)
“select distinct (姓名)as姓名”的意思是
select distinct id ,num=sum(cast((num) as int) from sy order by id desc
set rs=conn.execute("select distinct leibie from gstz order by leibie desc")
DISTINCT是什么意思
使用distinct?