sql语句查询时间的方式比较(代码实例)
程序员文章站
2022-09-02 21:57:29
sql语句查询时间的方式比较(代码实例)
select
e.id as "id",
e.enterprise_name as "enterpri...
sql语句查询时间的方式比较(代码实例)
select e.id as "id", e.enterprise_name as "enterprisename", y.industry_name as "industryname", d.district_name as "districtname", v.level_value as "levelvalue", v.sumscore as "sumscore" from ( ( enterprise e left join industry y on e.industry_id = y.id ) left join district d on e.district_id = d.id ) left join ( select i.enterprise_id,sum(i.index_score) sumscore,l.level_value from index_enterprise_year i left join level_enterprise_year l on i.enterprise_id = l.enterprise_id and l. year = i.year where i.year=2017 group by i.enterprise_id ) v on e.id=v.enterprise_id where e.enterprise_status = 10 order by sumscore desc limit 10
select e.id as "id", e.enterprise_name as "enterprisename", e.business_registration_no as "businessregistrationno", e.organization_code as "organizationcode", e.unified_credit_code as "unifiedcreditcode", e.legal_person_name as "legalpersonname", e.enterprise_telephone as "enterprisetelephone", e.registered_address as "registeredaddress", e.longitude as "longitude", e.dimension as "dimension", e.industry_id as "industryid", y.industry_name as "industryname", e.district_id as "districtid", d.district_name as "districtname", e.formula_id as "formulaid", e.enterprise_status as "enterprisestatus", sum(i.index_score) sumscore, l.level_value from ( ( ( enterprise e left join industry y on e.industry_id = y.id ) left join district d on e.district_id = d.id ) left join level_enterprise_year l on e.id = l.enterprise_id and l. year = 2017 ) left join index_enterprise_year i on e.id = i.enterprise_id and i. year = 2017 group by e.id having e.enterprise_status = 10 order by sumscore desc limit 10
两条语句时间相差75倍,了解下原因
上一篇: Android开发工具