| 
 | 
 
以下是我的minidao的sql- select count(1) from (select techown_report.ID as ID,
 
 - techown_report.name as apiname,
 
 - t_s_base_user.realname as sale,
 
 - techown_api.accountname as accountname,
 
 - techown_customer.customershort as customershort,
 
 - techown_api.price as price,
 
 - industry.typename as industryclassification,
 
 - account.typename as accounttype,
 
 - billingway.typename as billingway,
 
 - paymentway.typename as paymentway from techown_report
 
 - LEFT JOIN techown_api on techown_report.name=techown_api.apiname
 
 - LEFT JOIN techown_customer on techown_api.customerid=techown_customer.id
 
 - LEFT JOIN t_s_base_user on t_s_base_user.username=techown_customer.sale
 
 - LEFT JOIN (select t_s_type.typecode,t_s_type.typename from  t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='industry') as industry on techown_api.industryclassification=industry.typecode
 
 - LEFT JOIN (select t_s_type.typecode,t_s_type.typename from  t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='account') as account on techown_api.accounttype=account.typecode
 
 - LEFT JOIN (select t_s_type.typecode,t_s_type.typename from  t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='billingway') as billingway on techown_api.billingway=billingway.typecode
 
 - LEFT JOIN (select t_s_type.typecode,t_s_type.typename from  t_s_type LEFT JOIN t_s_typegroup on t_s_typegroup.ID=t_s_type.typegroupid where t_s_typegroup.typegroupcode='paymentway') as paymentway on techown_api.paymentway=paymentway.typecode
 
 - where 1=1
 
 - <#if accountname ?exists && accountname ?length gt 0>
 
 -         and accountname like :accountname
 
 - </#if>
 
 - <#if customershort ?exists && customershort ?length gt 0>
 
 -         and customershort like :customershort
 
 - </#if>
 
 - GROUP BY techown_report.name
 
 - ORDER BY techown_report.name) m
 
  复制代码 求优化方案。该如何做? 
 
 
 |   
 
 
 
 |