SQL获取数据-创新互联

SELECT

成都创新互联公司是一家以重庆网站建设、网页设计、品牌设计、软件运维、seo优化、小程序App开发等移动开发为一体互联网公司。已累计为餐厅设计等众行业中小客户提供优质的互联网建站和软件开发服务。

        COMPLAIN_CODE '投诉单号',

        ORDER_NO '订单号',

        RESPONSIBILITY '责任单位名称',

        CREATE_TIME '创建时间',

        COMPLAIN_TYPE '发起工单类型',

 DUTY_COMPLAIN_TYPE '定责投诉类型',

        COMPLAIN_SOUND_TYPE '声音归类',

        COMPLAIN_DATE '投诉日期',

        MEMO '情况说明',

 HANDLER1 "发起人工号",

 HANDLER2 "结束人工号",

 HANDLER_DATE1 "投诉开始时间",

 HANDLER_DATE2 "投诉结束时间",

        HANDLER_TYPE '处理类型',

        EOOR_SHIPPER_CONTACT '收货方联系人',

        EOOR_SHIPPER_CITY_NAME '发货地址城市',

        EOOR_CONSIGNEE_CITY_NAME '收货地址城市',

        EOOR_ORDER_TYPE '订单类型',

        SEND_DATE '发货时间',

        EOOR_SERVICE_MODE '服务类型',

        EOOS_SUPPLIER_FULL_NAME1'供应商全名',

        EOTS_LINK_TYPE '落地配'

FROM

        (

                  SELECT

                           t.COMPLAIN_CODE,

                           t.ORDER_NO,

                           t.RESPONSIBILITY,

                           t.CREATE_TIME,

                           CASE t.COMPLAIN_TYPE

                  WHEN 'SAFETY' THEN

                           '安全类'

                  WHEN 'CUSTOMER' THEN

                           '客户类'

                  WHEN 'AGEING' THEN

                           '时效类'

                  WHEN 'ACTION' THEN

                           '客户体验类'

                  WHEN 'DELIVERY' THEN

                           '配送类'

                  ELSE

                           '货代业务线上化'

                  END 'COMPLAIN_TYPE',

                  t.COMPLAIN_SOUND_TYPE,

                  t.COMPLAIN_DATE,

                  t.MEMO,

                  t.DUTY_COMPLAIN_TYPE,

                  b. HANDLER 'HANDLER1',

                  b.HANDLER_TYPE,

                  c.EOOR_SHIPPER_CONTACT,

                  c.EOOR_SHIPPER_CITY_NAME,

                  c.EOOR_CONSIGNEE_CITY_NAME,

                  c.EOOR_ORDER_TYPE,

                  c.SEND_DATE,

                  c.EOOR_SERVICE_MODE,

                  d.EOOS_SUPPLIER_FULL_NAME 'EOOS_SUPPLIER_FULL_NAME1',

   CASE e.EOTS_LINK_TYPE

   when '21' THEN '收货'

                  when '22' THEN '配单'

                  when '23' THEN '发货'

                  when '24' THEN '装机'

                  when '51' THEN '提货主单'

                  when '61' THEN '提货订单'

                  when '62' THEN '货代签收'

                  when '71' THEN '落地配交接'

                  when '72' THEN '落地配分配'

    ELSE

        '落地配签收'

   END 'EOTS_LINK_TYPE',

                  min(b.HANDLER_DATE) 'HANDLER_DATE1'

        FROM

                  cs_complained_info t

        LEFT JOIN cs_complained_handle_record b ON b. CODE = t.COMPLAIN_CODE

        LEFT JOIN eo_order c ON c.EOOR_ORDER_NO = t.ORDER_NO

        LEFT JOIN eo_order_supplier d ON d.EOOS_ORDER_NO = t.ORDER_NO

        LEFT JOIN eo_order_task_status e ON e.EOOR_ORDER_NO = t.ORDER_NO

        WHERE

                  t.HANDLE_STATUS = "DONE"

        AND T.ORDER_NO != " "

  AND t.CREATE_TIME > "2017-1-1"

        GROUP BY

                  t.COMPLAIN_CODE

        ) AS A

LEFT JOIN (

        SELECT

 t.COMPLAIN_CODE 'COMPLAIN_CODE2',

        b. HANDLER 'HANDLER2',

        max(b.HANDLER_DATE) 'HANDLER_DATE2'

FROM

        cs_complained_info t

LEFT JOIN cs_complained_handle_record b ON b. CODE = t.COMPLAIN_CODE

LEFT JOIN eo_order c ON c.EOOR_ORDER_NO = t.ORDER_NO

LEFT JOIN eo_order_supplier d ON d.EOOS_ORDER_NO = t.ORDER_NO

LEFT JOIN eo_order_task_status e ON e.EOOR_ORDER_NO = t.ORDER_NO

WHERE

        t.HANDLE_STATUS = "DONE"

AND b.HANDLER_RESULT = "FINISH"

AND T.ORDER_NO != " "

AND t.CREATE_TIME > "2017-1-1"

GROUP BY

        t.COMPLAIN_CODE

) AS B ON A.COMPLAIN_CODE = B.COMPLAIN_CODE2

ORDER BY COMPLAIN_CODE DESC

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文标题:SQL获取数据-创新互联
分享地址:http://myzitong.com/article/egdhj.html