社区
基础和管理
帖子详情
关于 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 关键字
...全文
434
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
select
distinct
order by的
问题
转载自 http://dingtao-wgs.blog.163.com/blog/static/50260714201110452518334/
oracle
中
select
distinct
和order by 的
问题
- [
Oracle
] 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明 http://kxfzly.blogbus.com/logs/3266543
distinct
返回null报错_
ORACLE
distinct
问题
我用了如下语句就报错:select
distinct
*fromA_Dtla,B_RTbwherea.MgrGid=b.MgrGidEx报错界面已上传,点下OK就提示未连接到
ORACLE
,但实际上是连接的,我用了select*fromdual仍能查出数...我用了如下语句就报错:select
distinct
* from A_Dtl a, B_RT b where a.MgrGid = b.MgrG...
Oracle
数据去重
问题
Insert into select
Distinct
问题
描述:将数据从
中
间表往业务表插入时,提示唯一键重复## 1 Insert into table1 (code)(select
distinct
code from table2) 上面的数据执行提示错误,我们选
中
后半部分查询,发现数据正常,code是唯一的 1 Create table table3 as select
distinct
code from table2; 2 Insert ...
oracle
中
lob类型的
distinct
问题
oracle
不支持对lob类型进行
distinct
,当运用jpa(hibernate)时,遇到连接查询需要对结果
distinct
时,会遇到ORA-22992。着实头疼,请问哪位有解决方案望不吝赐教!
Oracle
中
distinct
和order by 同时使用,可能出现的
问题
事例在
Oracle
数据库
中
执行SQL: select
distinct
name from tableName order by id 原本想过滤name字段重复值,并按照id进行排序,但是SQL报错,无法执行。 原因:SELECT语句
中
含有
DISTINCT
关键字或者有运算符时,排序用的字段必须与SELECT语句
中
出现的字段相对应。 网上搜到解释如下: 在 ordere b...
基础和管理
17,377
社区成员
95,111
社区内容
发帖
与我相关
我的任务
基础和管理
Oracle 基础和管理
复制链接
扫一扫
分享
社区描述
Oracle 基础和管理
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章