acgl4
2018-01-27 11:12
采纳率: 100%
浏览 1.0k

求大神帮忙改进一下sql语句

sql语句如下,前面是执行时间,求教怎么把查询速度优化至最大。
array(2) {
[0] => string(6) "4.1184"
[1] => string(316) "select a.custid from g_customer_tb a join g_customer_tbdata b on a.custid = b.custid where (b.rq > '2016-01-29 00:00:00 ' and b.rq < '2018-01-27 23:59:59') and a.shopid in (5,7,18,29,47,77,78,86,87,88,196,197,198,199) and( a.size1 = 1 or a.size2 = 1 or a.size3 = 1 ) group by b.custid having count(b.id) = 1"
}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

6条回答 默认 最新

相关推荐 更多相似问题