SELECT D_T,a.Shop2,a.SysCode,Sum(Quantity)
FROM VTransWhSellt a inner join etam.dbo.etamshop c on c.City<>1 and a.Shop2=c.ShopNo and a.shop2 not in (755,756)
and (D_T BETWEEN '2003-12-1' AND '2003-12-1')
AND not exists (SELECT SysCode FROM TransCheckOut where a.SysCode = SysCode)
GROUP BY D_T,a.Shop2,a.SysCode
FROM VTransWhSellt a inner join etam.dbo.etamshop c on c.City<>1 and a.Shop2=c.ShopNo and a.shop2 not in (755,756)
and (D_T BETWEEN '2003-12-1' AND '2003-12-1')
AND not exists (SELECT SysCode FROM TransCheckOut where a.SysCode = SysCode)
GROUP BY D_T,a.Shop2,a.SysCode
有索引的
他是联合主健之一
FROM VTransWhSellt a join etam.dbo.etamshop c
on c.City<>1 and a.Shop2=c.ShopNo and a.shop2 not in (755,756) and (D_T BETWEEN '2003-12-1' AND '2003-12-1')
AND not exists (SELECT 1 FROM TransCheckOut where SysCode=a.SysCode) GROUP BY D_T,a.Shop2,a.SysCode????
勇你的方法,基本上没什么区别
SELECT D_T,a.Shop2,a.SysCode,Sum(Quantity)
FROM VTransWhSellt a inner join etam.dbo.etamshop c on c.City<>1 and a.Shop2=c.ShopNo and a.shop2 not in (755,756)
and (D_T BETWEEN '2003-12-1' AND '2003-12-1')
AND not exists(SELECT SysCode FROM TransCheckOut a where a.SysCode=SysCode)
GROUP BY D_T,a.Shop2,a.SysCode
你的要22秒
我健索引的时候,一个索引包含了这两个字段,checknum在前面
你是说我应该在syscode上单独健一个索引