1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| SELECT as_jz_user_info.id 'id', as_jz_user_info.user_name 'userName', as_jz_user_info.mobile 'mobile', as_jz_cooperation_company_info.id 'companyId', as_jz_cooperation_company_info.coperrate_state 'coperrateState', as_jz_cooperation_company_info.estimate_order_num 'estimateOrderNum', as_jz_cooperation_company_info.estimate_order_amount 'estimateOrderAmount', as_jz_cooperation_company_sales.customer_level_id 'customerLevelId', as_jz_cooperation_company_sales.customer_level_name 'customerLevelName', as_jz_user_info.company 'company', as_inv_industry_classification .level_one 'levelOne', as_inv_industry_classification.level_one_name 'levelOneName', as_inv_industry_classification.level_three 'levelThree', as_inv_industry_classification.level_three_name 'levelThreeName', as_jz_cooperation_company_info. `customer_logo` 'logo', as_jz_user_info.create_time 'createTime', as_jz_cooperation_company_info.contract_date 'contractDate', as_jz_cooperation_company_info.contract_deadline 'contractDeadline', as_jz_cooperation_company_info.STATUS 'signStatus', as_jz_cooperation_company_sales.sign_up_name 'signName', as_jz_cooperation_company_sales.follow_up_name 'followName', as_tb_users_info.user_name 'followManageName', as_jz_user_info.customer_source 'customerSource', q.orderNum 'orderNum', q.orderAmount 'orderAmount', last_q.lastOrderNum 'lastOrderNum', last_q.lastOrderAmount 'lastOrderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info.company = as_jz_cooperation_company_info.company LEFT JOIN jz_cooperation_company_sales as_jz_cooperation_company_sales ON as_jz_cooperation_company_sales.company_id = as_jz_cooperation_company_info.id LEFT JOIN tb_users_info as_tb_users_info ON as_tb_users_info.fbi_user = as_jz_cooperation_company_info.manager_id LEFT JOIN inv_industry_classification as_inv_industry_classification ON as_inv_industry_classification.id = as_jz_cooperation_company_info .industry_id LEFT JOIN (SELECT as_jz_user_info.company 'company', COUNT(as_jz_order_info .id) 'orderNum', SUM(as_jz_order_info.payment_amount) 'orderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info .company = as_jz_cooperation_company_info.company LEFT JOIN jz_order_info as_jz_order_info ON as_jz_order_info .user_id = as_jz_user_info.id WHERE 1 = 1 AND as_jz_order_info .payment_status = '1' GROUP BY as_jz_user_info.company) q ON q.company = as_jz_user_info.company LEFT JOIN (SELECT as_jz_user_info.company 'company', COUNT(as_jz_order_info .id) 'lastOrderNum', SUM(as_jz_order_info.payment_amount) 'lastOrderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info .company = as_jz_cooperation_company_info.company LEFT JOIN jz_order_info as_jz_order_info ON as_jz_order_info .user_id = as_jz_user_info.id WHERE 1 = 1 AND as_jz_order_info .create_time >= ? AND as_jz_order_info.create_time <= ? AND as_jz_order_info.payment_status = '1' GROUP BY as_jz_user_info.company) last_q ON last_q.company = as_jz_user_info.company WHERE 1 = 1 AND as_jz_user_info.company_id > 0 GROUP BY as_jz_user_info.id ORDER BY as_jz_cooperation_company_info.manager_time desc, as_jz_user_info.id DESC limit ? , ? sg] == > Preparing: SELECT as_jz_user_info .id 'id', as_jz_user_info.user_name 'userName', as_jz_user_info.mobile 'mobile', as_jz_cooperation_company_info.id 'companyId', as_jz_cooperation_company_info.coperrate_state 'coperrateState', as_jz_cooperation_company_info.estimate_order_num 'estimateOrderNum', as_jz_cooperation_company_info.estimate_order_amount 'estimateOrderAmount', as_jz_cooperation_company_sales.customer_level_id 'customerLevelId', as_jz_cooperation_company_sales.customer_level_name 'customerLevelName', as_jz_user_info.company 'company', as_inv_industry_classification .level_one 'levelOne', as_inv_industry_classification.level_one_name 'levelOneName', as_inv_industry_classification.level_three 'levelThree', as_inv_industry_classification.level_three_name 'levelThreeName', as_jz_cooperation_company_info. `customer_logo` 'logo', as_jz_user_info.create_time 'createTime', as_jz_cooperation_company_info.contract_date 'contractDate', as_jz_cooperation_company_info.contract_deadline 'contractDeadline', as_jz_cooperation_company_info.STATUS 'signStatus', as_jz_cooperation_company_sales.sign_up_name 'signName', as_jz_cooperation_company_sales.follow_up_name 'followName', as_tb_users_info.user_name 'followManageName', as_jz_user_info.customer_source 'customerSource', q.orderNum 'orderNum', q.orderAmount 'orderAmount', last_q.lastOrderNum 'lastOrderNum', last_q.lastOrderAmount 'lastOrderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info.company = as_jz_cooperation_company_info.company LEFT JOIN jz_cooperation_company_sales as_jz_cooperation_company_sales ON as_jz_cooperation_company_sales.company_id = as_jz_cooperation_company_info.id LEFT JOIN tb_users_info as_tb_users_info ON as_tb_users_info.fbi_user = as_jz_cooperation_company_info.manager_id LEFT JOIN inv_industry_classification as_inv_industry_classification ON as_inv_industry_classification.id = as_jz_cooperation_company_info .industry_id LEFT JOIN (SELECT as_jz_user_info.company 'company', COUNT(as_jz_order_info .id) 'orderNum', SUM(as_jz_order_info.payment_amount) 'orderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info .company = as_jz_cooperation_company_info.company LEFT JOIN jz_order_info as_jz_order_info ON as_jz_order_info .user_id = as_jz_user_info.id WHERE 1 = 1 AND as_jz_order_info .payment_status = '1' GROUP BY as_jz_user_info.company) q ON q.company = as_jz_user_info.company LEFT JOIN (SELECT as_jz_user_info.company 'company', COUNT(as_jz_order_info .id) 'lastOrderNum', SUM(as_jz_order_info.payment_amount) 'lastOrderAmount' FROM jz_user_info as_jz_user_info LEFT JOIN jz_cooperation_company_info as_jz_cooperation_company_info ON as_jz_user_info .company = as_jz_cooperation_company_info.company LEFT JOIN jz_order_info as_jz_order_info ON as_jz_order_info .user_id = as_jz_user_info.id WHERE 1 = 1 AND as_jz_order_info .create_time >= ? AND as_jz_order_info.create_time <= ? AND as_jz_order_info.payment_status = '1' GROUP BY as_jz_user_info.company) last_q ON last_q.company = as_jz_user_info.company WHERE 1 = 1 AND as_jz_user_info.company_id > 0 GROUP BY as_jz_user_info.id ORDER BY as_jz_cooperation_company_info.manager_time desc, as_jz_user_info.id DESC limit ? , ?
|