From surenkid, 3 Months ago, written in MySQL.
Embed
  1. SELECT vv.`name`,vv.mobile,sum(o.totalprice) totalprice
  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. WHERE o.ispay = 1 AND o.id>9642
  6. AND (paytime BETWEEN UNIX_TIMESTAMP('2019-05-24 10:00') AND UNIX_TIMESTAMP('2019-05-24 17:30'))