这个sql怎么写??/急 id type num1 a 12 a 33 a 64 b 15 b 36 b 6想新增一行,得到type A 的最大值加上type B的最大值,即id type num100 c 12 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 insert into table1 select 100,'c' , (select max(num) from table1 where type='A')+(select max(num) from table1 where type='B') from table1 是这样的,表中type=a的最大值为6 type=b的最大值为6 想得到12这个值 insert into table1 select 100,'c' , (select max(num) from table1 where type='A')+(select max(num) from table1 where type='B') from table1 oraclelogan type的类型不确定,不能写死 如果type有很多,怎么办?上面的语句只是得到max(a)+max(b) INSERT INTO YOURTABLE (SELECT 100,'c' ,SUM(MAX(num)) FROM YOURTABLE GROUP BY TYPE) 如果想得到type中id最大的值相加该怎么办? 下面这种情况喃?谢谢!id type num num11 a 1 12 a 3 33 a 6 64 b 1 15 b 3 36 b 6 6想新增一行,得到type 中的最大id的num,num1相加,即 id type num num1100 c 12 12 INSERT INTO YOURTABLE (SELECT 100,'C',NUM+NUM1 AS NUM,NUM+NUM1 AS NUM1 FROM YOURTABLE WHERE ID=(SELECT MAX(ID) FROM YOURTABLE)) insert into yourtable select 100,',c', select sum(maxnum ) from (select type,max(num) maxnum from yourtable group by type) from dual insert into table1 select '100','c',sum(num) from (select max(num) as num from table1 group by type) 有没有人做过smallfile,bigfile,asm的性能比对,共享下测试结果,谢谢! 急急急 请那位高手帮忙解决问题存储过程的问题! 函数返回不确定列数的表结构,如何实现 数据导入 这样一个左连接PL/SQL语句该怎么写? 有懂Oracle安装和系统服务管理的没?急求建议!!! 如何将一个表设为readonly? 请问数据库的镜像问题! oracle 安装问题!急 死锁时怎么杀掉? 请问这个语句怎么写 请问一个关于用户权限的问题
select 100,'c' ,
(select max(num) from table1 where type='A')+(select max(num)
from table1 where type='B') from table1
type=b的最大值为6
想得到12这个值
select 100,'c' ,
(select max(num) from table1 where type='A')+(select max(num) from table1 where type='B')
from table1
SUM(MAX(num)) FROM YOURTABLE GROUP BY TYPE)
下面这种情况喃?谢谢!
id type num num1
1 a 1 1
2 a 3 3
3 a 6 6
4 b 1 1
5 b 3 3
6 b 6 6想新增一行,得到type 中的最大id的num,num1相加,即 id type num num1
100 c 12 12
select 100,',c', select sum(maxnum ) from (select type,max(num) maxnum from yourtable group by type) from dual