Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需要树形表SQL的请进 #122

Open
xunqinbo opened this issue Jul 23, 2022 · 0 comments
Open

需要树形表SQL的请进 #122

xunqinbo opened this issue Jul 23, 2022 · 0 comments

Comments

@xunqinbo
Copy link

本帖仅供参考

`
CREATE TABLE "region" (
"code" integer NOT NULL,
"name" text NOT NULL,
"parentCode" integer NOT NULL,
"level" integer NOT NULL,
CONSTRAINT "pk_code" PRIMARY KEY ("code")
);

INSERT INTO region
SELECT code,name,0,1
FROM province;

INSERT INTO region
SELECT code,name,provinceCode,2
FROM city;

INSERT INTO region
SELECT code,name,cityCode,3
FROM area;

INSERT INTO region
SELECT code,name, areaCode,4
FROM street;

INSERT INTO region
SELECT code,name,streetCode,5
FROM village;

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant