数据库 两张表
解决方案 »
- SQL语句包括哪些?create database 是SQL语句吗?
- 头大,请大虾提供百万数据查询优化思路。
- 请教一个SQL的执行顺序
- 求一个用not exists实现一个多对多关系的查询语句
- oracle会话问题
- execute immediate 和游标?
- 在命令行方式下使用如下:@showsql.sql方式调用SQL文件
- 在oracle8.1.7下用exp卸oracle8.1.5的数据库不可行,系统提示版本不支持,我该怎么办?
- 如何对一个oracle数据库进行维护和管理
- java.sql.SQLException: Io 异常: The Network Adapter could not establish the connec
- 数据库保存空格显示?问题
- 自定义oracle聚合函数问题。
select 1 te1,3 rent,'AAAA' ac from dual
union all
select 2 te1,12 rent,'AAAA' ac from dual
union all
select 3 te1,2 rent,'BBBB' ac from dual
union all
select 4 te1,6 rent,'CCCC' ac from dual),
s as(
select 1 te1,12 f1,3 f2,7 f3 from dual
union all
select 2 te1,11 f1,6 f2,12 f3 from dual
union all
select 3 te1,4 f1,1 f2,11 f3 from dual
)
select ac,sum(rent),NVL(sum(f1),0) f1 ,NVL(sum(f2),0) F2,NVL(sum(f3),0) F3
from t,s
where t.te1=s.te1(+)
group by ac
from dbo.A
left join dbo.B on A.tel =B.tel
group by acount这个是sqlserver的 ,挺简单的呀
基础