sql查询数据,查询全部速度很快,改成not in查询未销售就很慢,怎样优化谢谢!
查询全部的sql:SELECTSUM(ps.projectcount)ascount,m.mediatypename,s.nameFROMt_projectp,t_pro...
查询全部的sql:SELECT SUM(ps.projectcount) as count, m.mediatypename, s.name FROM t_project p, t_projectsize ps, shannxi.dbo.t_surround_value_report ss, shannxi.dbo.t_surround_ad_data sv, shannxi.dbo.t_surround_district s, t_mediatype_infor m WHERE p.mediatypeinfoid in ( select id from fn_get_mediatype_infor(4) ) AND ss.dataid = s.id AND sv.id = ss.projectid AND p.id = ps.projectid AND p.dataid = sv.id AND p.isdelete=0 AND p.companyid = 2248 AND p.regionid=s.regionid AND s.regionid = 354 AND ss.datatype=2 AND ss.distance=-1 AND p.mediatypeinfoid=m.id GROUP BY m.mediatypename, s.name 改成not in查询未销售的sql:SELECT SUM(ps.projectcount) as count, m.mediatypename, s.name FROM t_project p, t_projectsize ps, shannxi.dbo.t_surround_value_report ss, shannxi.dbo.t_surround_ad_data sv, shannxi.dbo.t_surround_district s, t_mediatype_infor m WHERE p.mediatypeinfoid in ( select id from fn_get_mediatype_infor(4) ) AND ss.dataid = s.id AND sv.id = ss.projectid AND p.id = ps.projectid AND p.dataid = sv.id AND p.isdelete=0 AND p.companyid = 2248 AND p.regionid=s.regionid AND s.regionid = 354 AND ss.datatype=2 AND ss.distance=-1 AND p.mediatypeinfoid=m.id AND p.id NOT IN ( SELECT mm.mediaid FROM t_sale_agreement_media mm ) GROUP BY m.mediatypename, s.name
展开
壹寰(深圳)科技文化有限公司
2021-03-27 广告
2021-03-27 广告
要找正规专业的公司,行业口碑也比较重要。更多详尽准确的信息可以找壹寰(深圳)科技文化有限公司。91数据恢复是壹寰(深圳)科技文化有限公司旗下专业数据恢复品牌,91数据恢复专注于勒索病毒数据恢复、勒索病毒数据修复、数据库修复、数据库解密恢复、...
点击进入详情页
本回答由壹寰(深圳)科技文化有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询