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"
}

求大神帮忙改进一下sql语句
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
6条回答 默认 最新
- weixin_40638970 2018-01-28 05:04关注
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"
}本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报