💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` select a.`sales_id` as '销售ID', `u`.`username` as '销售名称', `u`.`phone` as '销售手机号', a.`settle_month` as '销售月份', a.sum_money as '个人新增订单总额', a.order_group as '个人订单', b.sum_money as '企业新增订单总额', b.order_group as '企业订单', a.sum_money - b.sum_money as '个人订单 - 企业订单(差值)' from ( select concat(`sales_id`, `settle_month`) as 'salesmonth', sales_id as 'sales_id', settle_month as 'settle_month', sum(`new_amount`) as 'sum_money', GROUP_CONCAT(concat(`order_id`, '(', `new_amount`,')')) as 'order_group' from `sales_perform_bind_order_settled_detail` where settle_month in (202310, 202311, 202312) group by salesmonth ) a LEFT JOIN ( select concat(d.`sales_id`, d.`settle_month`) as 'salesmonth', d.sales_id as 'sales_id', d.settle_month as 'settle_month', sum(d.`new_amount`) as 'sum_money', GROUP_CONCAT(concat(`order_id`, '(', `new_amount`,')')) as 'order_group' from `sales_perform_bind_order_settled_detail` `d` INNER join `ep`.`ep_user` e on d.user_id = e.`user_id` where d.settle_month in (202310, 202311, 202312) group by salesmonth ) b on a.salesmonth = b.salesmonth left join `user` `u` on `a`.`sales_id` = `u`.`id` ``` ``` SELECT `m`.`server_id` AS '商家id', `i`.`merch_id` AS '码商id', `i`.`mini_app_id` AS '小程序id', `i`.`mini_app_name` AS '小程序名称' FROM `mini_info` `i` LEFT JOIN `code_merch` `m` ON `m`.`id` = `i`.`merch_id` WHERE `i`.`id` NOT IN ( SELECT `mini_info_id` AS 'mini_info_id' FROM ( SELECT `i`.`id` AS `mini_info_id`, `m`.`server_id` AS 'server_id', `m`.`id` AS 'merch_id', `m`.`name` AS 'merch_name', count( `o`.`order_id` ) AS 'count_order_num' FROM `mini_order_notify` `n` LEFT JOIN `mini_info` `i` ON i.mini_app_id = n.mini_app_id LEFT JOIN `mini_template_info` `t` ON t.template_id = i.template_id LEFT JOIN `code_merch` `m` ON m.id = `i`.`merch_id` LEFT JOIN `v3_order` `o` ON `m`.`server_id` = `o`.`server_id` WHERE ( `i`.`merch_id` IS NOT NULL AND `i`.`merch_id` != '' ) AND `o`.`created_at` BETWEEN UNIX_TIMESTAMP( CONCAT( '2023-12', '-01 00:00:00' ) ) AND UNIX_TIMESTAMP( CONCAT( '2024-01', '-16 23:59:59' ) ) AND `o`.`order_status` BETWEEN 2 AND 20 GROUP BY `m`.`server_id` ) a ) AND ( `i`.`merch_id` IS NOT NULL AND `i`.`merch_id` != '' ) SELECT `server_id` AS '商家id', `merch_id` AS '码商id', `merch_name` AS '码商商家名称', `count_order_num` AS '商家订单数量合计' FROM ( SELECT `m`.`server_id` AS 'server_id', `m`.`id` AS 'merch_id', `m`.`name` AS 'merch_name', count( `o`.`order_id` ) AS 'count_order_num' FROM `mini_order_notify` `n` LEFT JOIN `mini_info` `i` ON i.mini_app_id = n.mini_app_id LEFT JOIN `mini_template_info` `t` ON t.template_id = i.template_id LEFT JOIN `code_merch` `m` ON m.id = `i`.`merch_id` LEFT JOIN `v3_order` `o` ON `m`.`server_id` = `o`.`server_id` LEFT JOIN `tbl_server_info` `tsi` ON `tsi`.`server_id` = `o`.`server_id` WHERE ( `i`.`merch_id` IS NOT NULL AND `i`.`merch_id` != '' ) AND `o`.`created_at` BETWEEN UNIX_TIMESTAMP( CONCAT( '2023-12', '-01 00:00:00' ) ) AND UNIX_TIMESTAMP( CONCAT( '2024-01', '-16 23:59:59' ) ) AND `o`.`order_status` BETWEEN 2 AND 20 -- 剔除关店店铺 AND `tsi`.`status` = 20 GROUP BY `m`.`server_id` ) a ORDER BY `count_order_num` DESC ``` ``` select s.sales_id as '销售id', du.dd_name as '销售名称', du.dd_mobile as '手机号', u.phone as '系统手机号', u.username as '系统用户名', t.dept_name as '部门名称', du.occupation_name as '岗位名称', count(s.order_id) as '订单数', group_concat(s.order_id) as '订单合集' from sales_perform_order_bind s inner join v3_order o on s.order_id = o.order_id inner join `zulin_partition_4`.v3_order_ext po on s.order_id = po.order_id LEFT JOIN `user` u on s.sales_id = u.`id` LEFT JOIN `dingtalk_admin_user` au on au.admin_id = s.`sales_id` LEFT JOIN `dingtalk_user` du on au.user_id = du.id LEFT JOIN `dingtalk_department` t on du.dd_dept_id_list = t.id WHERE `s`.`order_id` BETWEEN 2024050100000000 and 2024060100000000 and o.`order_status` BETWEEN 2 and 20 and po.city = t.city GROUP BY s.`sales_id` ``` ``` SELECT s.sales_id AS '销售id', du.dd_name AS '销售名称', du.dd_mobile AS '手机号', u.phone AS '系统手机号', u.username AS '系统用户名', t.dept_name AS '部门名称', du.occupation_name AS '岗位名称', c.name as '二级标记', c1.name as '一级标记', sum(s.`new_amount`) as '业绩', count(s.order_id) AS '订单数', group_concat(s.order_id) AS '订单合集' FROM `sales_perform_bind_order_settled_detail` s INNER JOIN v3_order o ON s.order_id = o.order_id LEFT JOIN `user` u ON s.sales_id = u.`id` LEFT JOIN `dingtalk_admin_user` au ON au.admin_id = s.`sales_id` LEFT JOIN `dingtalk_user` du ON au.user_id = du.id LEFT JOIN `dingtalk_department` t ON du.dd_dept_id_list = t.id left join `product`.`sales_tag` `st` on `st`.`object_id` = `o`.`item_id` left join `product`.`tag` `c` on `c`.`id` = `st`.`tag_id` left join `product`.`tag` `c1` on `c1`.`id` = `c`.`pid` WHERE `s`.`order_id` BETWEEN 2024080100000000 AND 2024090100000000 AND o.`order_status` BETWEEN 2 AND 20 and `st`.`type` = 2 AND t.dept_name = '企业销售五部' GROUP BY s.`sales_id`, c.name, c1.name ``` ``` -- 抖音微企租账号接待留资-运营取数 SELECT o.order_id as '订单号', o.phone as '手机号', o.user_id as '用户id', o.server_id as '商家id', o.item_id as '商品id', DATE_FORMAT( FROM_UNIXTIME(o.time_start), '%Y-%m-%d %H:%i' ) as '租期(开始时间)', DATE_FORMAT( FROM_UNIXTIME(o.time_end), '%Y-%m-%d %H:%i' ) as '租期(结束时间)', o.rental_money as '订单总租金', o.rental_need_pay as '需付租金', CASE o.order_status WHEN '1' THEN '待付款' WHEN '2' THEN '待发货' WHEN '3' THEN '待收货' WHEN '4' THEN '待归还' WHEN '5' THEN '归还中' WHEN '6' THEN '已归还' WHEN '7' THEN '待风控' WHEN '10' THEN '等待服务中' WHEN '13' THEN '正在租赁中(未确认)' WHEN '14' THEN '正在租赁中(已确认转租金)' WHEN '17' THEN '申请退押中' WHEN '18' THEN '退款中' WHEN '19' THEN '已买断' WHEN '20' THEN '交易完成' WHEN '21' THEN '订单关闭(用户)' WHEN '22' THEN '订单关闭(租赁商)' WHEN '23' THEN '订单关闭(系统)' WHEN '24' THEN '订单关闭(已退款)' WHEN '30' THEN '已删除' ELSE '未知' END '状态', CASE WHEN JSON_EXTRACT(ro.report_json, '$.result_info') IS NOT NULL THEN JSON_UNQUOTE(JSON_EXTRACT(ro.report_json, '$.result_info.risk_result.value')) ELSE '空' END as '风控结果' FROM `v3_order` `o` left join `risk_report_order` `ro` on `ro`.`order_id` = `o`.`order_id` WHERE o.phone IN ( 17315063888 ) order by o.phone asc ``` ``` select a1.sales_id, a1.dd_name, a1.dd_mobile, a1.wc_account, GROUP_CONCAT(concat(a1.`ep_name`, '(', FROM_UNIXTIME(a1.`auth_complete_time`) ,')')) as 'ep_group', a1.sum_money, a1.order_group, a1.is_pull_group, a1.group_name, a1.group_created_at, a1.we_group_created_month from ( select osd.sales_id as 'sales_id', du.dd_name as 'dd_name', du.dd_mobile as 'dd_mobile', ew_user.wc_account as 'wc_account', `ei`.`ep_name` as 'ep_name', `ei`.`auth_complete_time` as `auth_complete_time`, sum(`osd`.`new_amount`) as 'sum_money', GROUP_CONCAT( concat(`osd`.`order_id`, '(', `osd`.`new_amount`, ')') ) as 'order_group', case when ew_g.group_id is not null then '是' else '' end as 'is_pull_group', ew_g.group_name, `ew_g`.`group_created_at`, case when `ew_g`.`group_created_at` != 0 then FROM_UNIXTIME(`ew_g`.`group_created_at`, '%Y-%m') else '' end AS 'we_group_created_month' from `zulin`.`sales_perform_bind_order_settled_detail` `osd` inner join `zulin`.`v3_order` `o` on `o`.`order_id` = `osd`.`order_id` -- 企微群信息(开始) inner join `zulin`.`ep_wechat_admin_user` `ew_au` on `ew_au`.`admin_id` = `osd`.`sales_id` left join `zulin`.`ep_wechat_user` `ew_user` on `ew_user`.`id` = `ew_au`.`user_id` left join `ep`.`ep_wechat_customer_group_member` `ew_gm` on `ew_gm`.`user_id` = `ew_user`.`wc_account` left join `ep`.`ep_wechat_customer_group` `ew_g` on `ew_g`.`group_id` = `ew_gm`.`group_id` -- 企微群信息(结束) -- 销售信息(开始) LEFT JOIN `zulin`.`dingtalk_admin_user` `au` on `au`.`admin_id` = `osd`.`sales_id` LEFT JOIN `zulin`.`dingtalk_user` `du` on `au`.`user_id` = `du`.`id` LEFT JOIN `zulin`.`dingtalk_department` `dt` on `du`.`dd_dept_id_list` = `dt`.`id` -- 销售信息(结束) -- 企业信息(开始) left join `ep`.`ep_manager` `epm` on `epm`.`sales_id` = `osd`.`sales_id` left join `ep`.`ep_info` `ei` on `ei`.`id` = `epm`.`ep_id` -- 企业信息(结束) where `osd`.`settle_month` in (202411) and `ei`.`auth_complete_time` BETWEEN UNIX_TIMESTAMP(CONCAT('2024-11', '-01 00:00:00')) AND UNIX_TIMESTAMP(CONCAT('2024-11', '-30 23:59:59')) and `ei`.`status` = 1 and `epm`.`sales_id` IS NOT NULL GROUP BY `ei`.`id` order by osd.sales_id asc ) a1 group BY a1.sales_id ```