sql1:"select..." 它返回的结果如下:
id count
1 10
2 20
3 30
4 40
我现在想对count求最大值,然后对应每个ID,对sql1查询1次,怎么写??得到如下结果:
id count max
1 10 40
2 20 40
3 30 40
4 40 40
id count
1 10
2 20
3 30
4 40
我现在想对count求最大值,然后对应每个ID,对sql1查询1次,怎么写??得到如下结果:
id count max
1 10 40
2 20 40
3 30 40
4 40 40
解决方案 »
- 批量删除数据的方法
- 定义连接
- 在linux下用proc/c++往oracle里写汉字的问题(汉字给拆了,不知如何解决)
- 大哥大姐进来看一看创建对象带上not instantiable选项为什么会出现这种错误
- 多表视图的问题
- 查询问题,类似group by。
- 高手请进:请问我在GBK字符集下做的备份能恢复到UNICODE字符集的数据库中吗?
- 这样的sql语句如何写
- 请教,如何删除 被删除用户的(且忘了表空间名的)表空间?
- Oracle 在pl/sql develop查询数据,不加sid前缀查询不出来数据是什么原因?
- 如何得到三张表的全连接?
- 我想在oracle9.2企业管理中进行备份设置,但一点击"备份..."就提示说只有在应用程序已经连接到OMS时才能启动此向导.
table1 a,
(select max(t.count) from table1) b
table1 a,
(select max(t.count) from table1 t) b忘记给表取别名了
max(count) over() as "max_count"
from (
select tt.id,
count(*) as "count"
from tablename tt
group by tt.id
)zz;
select distinct dd.d1,dd.d2,max(t.count) over()
from demo t
inner join ( select d.id d1,sum(d.count) d2
from demo d group by d.id) dd on dd.d1=t.id
order by dd.d1