SQL1:
select sLY,sum(fZJE) from (
select sLY,sum(fZJE) as fZJE from DB1..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30' group by sLY
union all
select sLY,sum(fZJE) as fZJE from DB2..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30' group by sLY)a
group by sLYSQL2:
select sLY,sum(fZJE) from (
select * from DB1..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30'
union all
select * from DB2..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30')a
group by sLY请问,哪个SQL效率最高?
select sLY,sum(fZJE) from (
select sLY,sum(fZJE) as fZJE from DB1..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30' group by sLY
union all
select sLY,sum(fZJE) as fZJE from DB2..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30' group by sLY)a
group by sLYSQL2:
select sLY,sum(fZJE) from (
select * from DB1..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30'
union all
select * from DB2..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30')a
group by sLY请问,哪个SQL效率最高?
解决方案 »
- 怎么读取directorylistbox、drivecombobox、filelistbox里的一个文件
- delphi调用vc编写dll出错的请教
- 日期格式转化。。。。
- 服务端程序运行后立即退出!
- 我是一个DELPHI初学者,,有C,VB的基础,想尽快掌握DELPHI的基础,并能进行一些简单的开发,,请指点在学习的过程中需要注意哪些或者说给点学习
- 请教大家一个程序启动时遇到的问题!
- 紧急求救:怎样通过汉字编码获得汉字的声母
- 高分求救:Delphi访问数据库时字符串长度限制的怪问题!
- 求救!关于masterfields
- 启动画面的制作?
- "应用程序发生异常未知的软件异常(0x0eedfade),位置为0x7c812afb"
- Delphi大虾指路 不胜感激
2.再用下面的查询:
select sLY,sum(fZJE) from (
select SlY,fZJE from DB1..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30'
union all
select SlY,fZJE from DB2..FYMXB where dSJ>'2009-10-1' and dSJ<'2010-4-30')a
group by sLY