From 周洪攀, 2 Months ago, written in MySQL.
This paste is a reply to 初灵所有种子代理商下属订单明细列表 from surenkid - view diff
Embed
  1. SELECT vv.`name` 种子姓名,vv.mobile 种子手机,v.`name` 顾客姓名,v.mobile 顾客手机,FROM_UNIXTIME(o.paytime) 支付时间,o.totalprice 订单总额,o.vipname 收货姓名,o.vipmobile 收货手机,o.vipaddress 收货地址,o.items 订单,GROUP_CONCAT(CAST(od.goodsname AS char),'(数量:',od.num,')'  SEPARATOR ';')商品详情
  2. FROM wfx_shop_order o
  3. LEFT JOIN wfx_vip v ON o.vipid = v.id
  4. LEFT JOIN wfx_vip vv ON SUBSTRING(SUBSTRING_INDEX(v.path,"-",2),3) = vv.id
  5. LEFT JOIN wfx_shop_order_detail od ON o.id = od.oid
  6. WHERE o.ispay = 1 AND o.id>9642
  7. GROUP BY od.oid
  8. ORDER BY vv.id