内联一个表后,加载时间变得特慢
SELECT dbo.tbReWu.HThao AS 合同号, dbo.tbReWu.ZDRQ AS 入库日期, dbo.tbChuanMing.Name AS 船名, dbo.tbHWXX.Hangci AS 航次,
CASE WHEN dbo.tbHWXX.NWMao = 'true' THEN '内贸' ELSE '外贸' END AS 内外贸, dbo.tbXHDian.Name AS 场地, dbo.tbHWXX.YDLiang AS 提单量,
dbo.tbHWXX.RKLiang AS 入库过磅吨, dbo.tbHWXX.YDLiang - dbo.tbHWXX.RKLiang AS 入库盈亏吨, dbo.tbHWXX.CKLiang AS 发货吨,
dbo.tbHWXX.CuiLiang AS 剩余吨, dbo.tbReWu.PMID, dbo.tbHWMX.SHFID
FROM dbo.tbDBDataHj INNER JOIN
dbo.tbReWu ON dbo.tbDBDataHj.RWHao = dbo.tbReWu.RWHao INNER JOIN
dbo.tbHWMX ON dbo.tbReWu.ZYHao = dbo.tbHWMX.ZYHao INNER JOIN
dbo.tbHWXX ON dbo.tbHWMX.BianHao = dbo.tbHWXX.BianHao INNER JOIN
dbo.tbChuanMing ON dbo.tbHWXX.CMID = dbo.tbChuanMing.CCID INNER JOIN
dbo.tbXHDian ON dbo.tbReWu.XHDID = dbo.tbXHDian.CCID
GROUP BY dbo.tbChuanMing.Name, dbo.tbHWXX.Hangci, dbo.tbReWu.ZDRQ, dbo.tbHWXX.NWMAO, dbo.tbXHDian.Name, dbo.tbHWXX.YDLiang, dbo.tbHWXX.RKLiang,
dbo.tbHWXX.CKLiang, dbo.tbHWXX.CuiLiang, dbo.tbReWu.HThao, dbo.tbReWu.PMID, dbo.tbHWMX.SHFID
其中,如果去掉最后一个内联,加载很快,即INNER JOIN
dbo.tbChuanMing ON dbo.tbHWXX.CMID = dbo.tbChuanMing.CCID 去掉,就可以,不知什么原因?
------解决方案--------------------SELECT dbo.tbReWu.HThao AS 合同号 ,
dbo.tbReWu.ZDRQ AS 入库日期 ,
dbo.tbChuanMing.Name AS 船名 ,
dbo.tbHWXX.Hangci AS 航次 ,
CASE WHEN dbo.tbHWXX.NWMao = 'true' THEN '内贸'
ELSE '外贸'
END AS 内外贸 ,
dbo.tbXHDian.Name AS 场地 ,
&n