提问【求助】写个SQL,或者提供一下其他实现方式

要实现下拉框显示的结果:
微信截图_20220217095411.png

求查询SQL怎么写?

?????????????????????????

 

数据表:sc_prop

微信截图_20220217095521.png

CREATE TABLE “sc_prop” (
“prop_pk” varchar(50) COLLATE “pg_catalog”.”default” NOT NULL,
“prop_key” varchar(100) COLLATE “pg_catalog”.”default” NOT NULL,
“prop_value” text COLLATE “pg_catalog”.”default”,
“prop_remark” text COLLATE “pg_catalog”.”default”,
“prop_group” varchar(50) COLLATE “pg_catalog”.”default”,
“status” varchar(10) COLLATE “pg_catalog”.”default”,
“real_value” int4
)
;
COMMENT ON COLUMN “sc_prop”.”prop_pk” IS ‘配置编号’;
COMMENT ON COLUMN “sc_prop”.”prop_key” IS ‘主键’;
COMMENT ON COLUMN “sc_prop”.”prop_value” IS ‘值’;
COMMENT ON COLUMN “sc_prop”.”prop_remark” IS ‘名称’;
COMMENT ON COLUMN “sc_prop”.”prop_group” IS ‘组’;
COMMENT ON COLUMN “sc_prop”.”status” IS ‘0现在,1其他’;
COMMENT ON COLUMN “sc_prop”.”real_value” IS ‘学年或学期’;
COMMENT ON TABLE “sc_prop” IS ‘学年学期表’;

— —————————-
— Records of sc_prop
— —————————-
INSERT INTO “sc_prop” VALUES (‘d9100506-8fd4-4166-abb9-1a5c7da8806f’, ‘STU_YEAR’, ‘2023学年’, ‘学年’, ‘SCORE’, ‘1’, 2023);
INSERT INTO “sc_prop” VALUES (‘2’, ‘STU_TERM’, ‘第二学期’, ‘学期’, ‘SCORE’, ‘1’, 2);
INSERT INTO “sc_prop” VALUES (‘1’, ‘STU_TERM’, ‘第一学期’, ‘学期’, ‘SCORE’, ‘0’, 1);
INSERT INTO “sc_prop” VALUES (‘3’, ‘STU_YEAR’, ‘2018学年’, ‘学年’, ‘SCORE’, ‘1’, 2018);
INSERT INTO “sc_prop” VALUES (‘4’, ‘STU_YEAR’, ‘2019学年’, ‘学年’, ‘SCORE’, ‘1’, 2019);
INSERT INTO “sc_prop” VALUES (‘5’, ‘STU_YEAR’, ‘2020学年’, ‘学年’, ‘SCORE’, ‘1’, 2020);
INSERT INTO “sc_prop” VALUES (‘6’, ‘STU_YEAR’, ‘2021学年’, ‘学年’, ‘SCORE’, ‘0’, 2021);
INSERT INTO “sc_prop” VALUES (‘8ada68a8-ba4e-431d-98e5-89d6c4886a0d’, ‘STU_YEAR’, ‘2022学年’, ‘学年’, ‘SCORE’, ‘1’, 2022);
INSERT INTO “sc_prop” VALUES (‘4ba21f1b-ea0f-42ed-b8fc-10fb1bc815e7’, ‘STU_YEAR’, ‘2010学年’, ‘学年’, ‘SCORE’, ‘1’, 2010);
INSERT INTO “sc_prop” VALUES (‘ca520dee-8577-4618-b885-d3c9d0e2ed6e’, ‘STU_YEAR’, ‘2011学年’, ‘学年’, ‘SCORE’, ‘1’, 2011);
INSERT INTO “sc_prop” VALUES (‘dce67316-9a86-4dba-850e-99cae9b8ca3d’, ‘STU_YEAR’, ‘2012学年’, ‘学年’, ‘SCORE’, ‘1’, 2012);
INSERT INTO “sc_prop” VALUES (‘5b7800a4-c7af-49e5-bb54-f96c2af559bb’, ‘STU_YEAR’, ‘2013学年’, ‘学年’, ‘SCORE’, ‘1’, 2013);
INSERT INTO “sc_prop” VALUES (’12b65f14-6be4-4a24-8a58-f8c512416589′, ‘STU_YEAR’, ‘2014学年’, ‘学年’, ‘SCORE’, ‘1’, 2014);
INSERT INTO “sc_prop” VALUES (‘e5d47ab4-aefd-4b3d-abf9-446742388a0d’, ‘STU_YEAR’, ‘2015学年’, ‘学年’, ‘SCORE’, ‘1’, 2015);
INSERT INTO “sc_prop” VALUES (‘8f338ca1-f880-4213-900b-485fa407b15d’, ‘STU_YEAR’, ‘2016学年’, ‘学年’, ‘SCORE’, ‘1’, 2016);
INSERT INTO “sc_prop” VALUES (‘602a8bfe-fca6-4ef1-bd0b-5a8bddc3cd2a’, ‘STU_YEAR’, ‘2017学年’, ‘学年’, ‘SCORE’, ‘1’, 2017);

— —————————-
— Primary Key structure for table sc_prop
— —————————-
ALTER TABLE “sc_prop” ADD CONSTRAINT “sc_prop_pkey” PRIMARY KEY (“prop_pk”);

请登录后发表评论

    • Evan的头像-SpringForAll社区Evan作者0