[关闭]
@andrewwang 2017-02-14T16:57:40.000000Z 字数 567 阅读 616

性能

技术


sql

多表处理

分布式缓存,分表分库

  1. SELECT DISTINCT
  2. t1.id,
  3. t1.latitude,
  4. t1.longitude,
  5. t1.address,
  6. t2.id AS servantId,
  7. t2. NAME,
  8. t2.sex,
  9. t2.head_image,
  10. getDistance (
  11. 31.23551214170 ,121.39876467142,
  12. t1.latitude,
  13. t1.longitude
  14. ) AS distance
  15. FROM
  16. work_work_store t1,
  17. work_servant t2,
  18. work_servant_work t3,
  19. mall_sale_item_sku t4
  20. WHERE
  21. t1. STATUS =1
  22. AND t1.is_default =1
  23. AND t2. STATUS =1
  24. AND t2.audit =4
  25. AND t2.is_npc =0
  26. AND t2.service_status ='online'
  27. AND t2.id = t1.servant_id
  28. AND t4.item_id =111112
  29. AND t4.id = t3.item_sku_id
  30. AND t3.servant_id = t2.id
  31. AND getDistance (
  32. 31.23551214170 ,121.39876467142,
  33. t1.latitude,
  34. t1.longitude
  35. ) < 3
  36. ORDER BY
  37. distance ASC
  38. LIMIT 10
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注