Data processing 4-bit tree code expanded to 6-bit

Source: Internet
Author: User

Raw Data

1 Administrative Logistics 0001
2 Hospital Office000104810002
4 Propaganda Room 000104810004
5 General Registry 000104810005
6 mailroom 000104810006
7 Fleet 000104810007
8 Human Resources Department 00010008
10 Hospital Control Office 00010010
11 Medical records Management Office 00010011
12 Department of Nursing 00010012
13 Disinfection Supply Center 01720013
14 Science and Education Office 00010014
16 College Office 00010016
17 Audit Office 00010017
18 Trade Unions 00010018
19 Youth League 00010019
20 Finance Office 00010020
22 with two outpatient service charge 000100200022
23 Children's Gate emergency 000100200023
24 with two inpatient charge 000100200024
27 Child hospitalization Charge 000100200027

method One:

With the tree as (   select Ksdm,ksmc,case len (KSWM) When 4 then "when 8 Then '" +substring (kswm,1,4) when the then ' xx ' +s Ubstring (kswm,5,4) when the then ' xx ' +substring (kswm,9,4) end as P,case Len (KSWM) when 4 Then ' xx ' +kswm when 8 then ' xx ' +su Bstring (kswm,5,4) when the then ' xx ' +substring (kswm,9,4) when the then ' xx ' +substring (kswm,13,4) end as C from     KS), CTE a S (-->begin locator point   Select Ksdm,ksmc,c as kswm,c,p,1 as Levle from tree where p= "    -->end   UNION ALL    --& Gt;begin   Select Tree.ksdm,tree.ksmc,cte.kswm+tree.c as kswm,tree.c,tree.p,levle+1 as Levle from tree inner join CTE O n tree.p=cte.c     -->end) SELECT * from the CTE ORDER by KSWM
Method Two:

Excel functions

=if (LEN (C3) >4,concatenate ("xx", MID (c3,5,4)), "")


Data processing 4-bit tree code expanded to 6-bit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.