社区
基础和管理
帖子详情
关于 Oracle中 distinct 的问题
unkind1145
2009-05-31 05:44:19
RT:
select *, count(distinct name) from table group by name
结果:
id name count(distinct name)
1 a 1
2 b 1
3 c 1
为什么报 ORA-00923: 未找到要求的 FROM 关键字
...全文
397
14
打赏
收藏
关于 Oracle中 distinct 的问题
RT: select *, count(distinct name) from table group by name 结果: id name count(distinct name) 1 a 1 2 b 1 3 c 1 为什么报 ORA-00923: 未找到要求的 FROM 关键字
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
14 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
unkind1145
2009-05-31
打赏
举报
回复
还是有点问题
要是列数多了 而且不是id列的话
就相当于没有进行重复的筛选
superhsj
2009-05-31
打赏
举报
回复
select rownum,NAME from (select NAME from table group by name);
superhsj
2009-05-31
打赏
举报
回复
select rownum,NAME from table group by name
[Quote=引用 11 楼 unkind1145 的回复:]
table表
字段1 字段2
id name
1 a
2 b
3 c
4 c
5 b
结果要是这样的
1 a
2 b
3 c
[/Quote]
unkind1145
2009-05-31
打赏
举报
回复
table表
字段1 字段2
id name
1 a
2 b
3 c
4 c
5 b
结果要是这样的
1 a
2 b
3 c
heaven33
2009-05-31
打赏
举报
回复
不能在SELECT中显示没有进行 oder by 的列
unkind1145
2009-05-31
打赏
举报
回复
现在是不重复了 但是另外2列的数据显示不出来了 。。
unkind1145
2009-05-31
打赏
举报
回复
现在是不重复了 但是另外2列的数据显示不出来了 。。
heaven33
2009-05-31
打赏
举报
回复
你已经group by 了 怎么还会有重复的呢?
heaven33
2009-05-31
打赏
举报
回复
你可以写
select NAME, count(NAME) from table group by name
你写distinct 干什么呢
unkind1145
2009-05-31
打赏
举报
回复
。。
要去掉name列中的重复值 还要显示 其他2列的呀~
heaven33
2009-05-31
打赏
举报
回复
你可以写
select NAME, count(NAME) from table group by name
你写distinct 干什么呢
unkind1145
2009-05-31
打赏
举报
回复
去掉的话 没有显示name的表头和值了
heaven33
2009-05-31
打赏
举报
回复
你使用了count 函数 应该就不能使用* 了吧 应该只能显示name这一列
heaven33
2009-05-31
打赏
举报
回复
group by 的查询语句中可以使用 *么?去掉*试试
Oracle
中
distinct
的用法实例以及
Oracle
distince 用法和删除重复数据
Oracle
中
distinct
的用法实例 摘要: 此外,
distinct
会对返回的结果集进行排序 所以会大大影响查询效率,大数据集时比较明显 。所以,最好和order by 结合使用,可以提高效率 。 select
distinct
a,b,c from t...
oracle
distinct
的用法,
oracle
中
distinct
的用法详解
下面先来看看例子:table表字段1 字段2 id name 1 a 2 b 3 c 4 c 5 b库结构大概这样,这只是一个简单的例子,实际情况会复杂得多。比如我想用一条语句查询得到name不重复的所有数据,那就必须使用
distinct
去掉...
oracle
distinct
的用法,
Oracle
Distinct
oracle
函数 的
Oracle
Distinct
在本教程
中
,将学习如何使用
Oracle
SELECT
DISTINCT
语句从表
中
查询不同的数据。
Oracle
SELECT
DISTINCT
语句简介在语句
中
使用
DISTINCT
子句来过滤结果集
中
的重复行。它确保在SELECT子句...
oracle
中
distinct
用法
select
distinct
name from A 2、作用于多列 select
distinct
name, id from A select
distinct
xing, ming from B 返回的结果为两行,这说明
distinct
并非是对xing和ming两列“字符串拼接”后再去重的,而是分别...
oracle
中
distinct
和count函数组合使用
oracle
中
的
distinct
关键字和count函数需要经常组合起来使用 例如,如果我们拿到一个仅有员工基本信息的列表,我们希望得到这个公司共有多少个部门。 我们可以这样做: select count(a.deptno) from ...
基础和管理
17,377
社区成员
95,128
社区内容
发帖
与我相关
我的任务
基础和管理
Oracle 基础和管理
复制链接
扫一扫
分享
社区描述
Oracle 基础和管理
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章