请问,如何修改下面的sql语句,从而提高性能,具体sql如下
--本期应开票金额---耗时350/60 5.9分钟
SELECT T1.FAsstActID,
SUM(T2.FRecievePayAmountLocal) AS BQYSAMOUNT
FROM T_AR_OtherBill T1
INNER JOIN T_AR_OtherBillentry T2 ON T1.FID=T2.FParentID
where (to_char(T1.FBizDate,'YYYY-MM-DD') >= '2016-02-01'
AND to_char(T1.FBizDate,'YYYY-MM-DD') <= '2019-04-03' )
AND ( T1.FCurrencyID = '' OR null IS NULL )
AND ( T1.FBillStatus =3 )
AND ( T1.FCompanyID = 'sREAAAAAB9LM567U')
GROUP BY T1.FAsstActID
下面一段是我根据上面一段优化后的sql,但是感觉不行,请问没有没有更好的优化?
--优化后
SELECT T1.FAsstActID,
SUM(T2.FRecievePayAmountLocal) AS BQYSAMOUNT
FROM (SELECT FAsstActID,FID
FROM T_AR_OtherBill
WHERE (to_char(FBizDate,'YYYY-MM-DD') >= '2016-02-01'
AND to_char(FBizDate,'YYYY-MM-DD') <= '2019-04-03' )
AND ( FCurrencyID = '' OR null IS NULL )
AND ( FBillStatus =3 )
AND ( FCompanyID = 'sREAAAAAB9LM567U' )
) T1
INNER JOIN T_AR_OtherBillentry T2 ON T1.FID=T2.FParentID
GROUP BY T1.FAsstActID
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论