注册 登录
编程论坛 SQL Server论坛

请问执行效率问题!

yafengliang 发布于 2018-11-12 23:17, 1801 次点击
SELECT 000 as 序号, a.编号, a.名称, a.规格, a.期初数量,
         cast( b.数量 as int) as 入库数量,cast(c.总数量 as int) as 出库数量,cast(a.期初数量+isnull(b.数量,0)-isnull(c.总数量,0) as int) as 当前库存
    FROM dbo.b_产品 as a
     left join(select 产品id,sum(数量) as 数量 from dbo.r_产品入库表 group by 产品id ) as b on a.id = b.产品id
    left join (select 产品id,sum(总数量) as 总数量 from dbo.x_销售表 group by 产品id) as c ON b.产品id = c.产品id

请问在sql server中用上面语句进行视图查询,对于数据量大的表(几十万)执行效率如何?
1 回复
#2
mywisdom882018-11-15 19:13
几十万,不会
1