日期:2014-05-17 浏览次数:20346 次
select a.code as 编码,a.quantity as 数量,b.time as 时间 from (select * From table1) a, (select * From table2) b where a.flag=b.flag
可以替换为
select a.code as 编码,a.quantity as 数量,b.time as 时间
from table1 a,table2 b
where a.flag=b.flag
所以你9楼的语句可以替换为
select a.code as [编码],b.time as [时间],sum(a.quantity) as [数量]
from table1 a,table2 b
where a.flag=b.flag
group by a.code,b.time