首页 > 数据库 >南沙拆迁项目 SQL 语句

南沙拆迁项目 SQL 语句

时间:2022-08-20 10:24:20浏览次数:51  
标签:语句 objectid MC SELECT ZLFHJGXX FHJGXX SQL respyattr 南沙

赋值语句相关

房屋分类拆分语句

SELECT
 *
 FROM
     (
         SELECT
             OBJECTID, DCODE
             , ZLFHJGXX(FHJGXX, 'C', 1, 1) MC
             , ZLFHJGXX(FHJGXX, 'C', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, 'C', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, 'C', 1, 4) CS
             , ZLFHJGXX(FHJGXX, 'C', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             OBJECTID, DCODE
             , ZLFHJGXX(FHJGXX, 'B', 1, 1) MC
             , ZLFHJGXX(FHJGXX, 'B', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, 'B', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, 'B', 1, 4) CS
             , ZLFHJGXX(FHJGXX, 'B', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             OBJECTID, DCODE
             , ZLFHJGXX(FHJGXX, 'A', 1, 1) MC
             , ZLFHJGXX(FHJGXX, 'A', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, 'A', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, 'A', 1, 4) CS
             , ZLFHJGXX(FHJGXX, 'A', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             OBJECTID, DCODE
             , ZLFHJGXX(FHJGXX, '飘楼', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '飘楼', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '飘楼', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '飘楼', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '飘楼', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX( FHJGXX, '飘楼', 2, 1) MC
             , ZLFHJGXX(FHJGXX, '飘楼', 2, 2) JSXS
             , ZLFHJGXX(FHJGXX, '飘楼', 2, 3) SXH
             , ZLFHJGXX(FHJGXX, '飘楼', 2, 4) CS
             , ZLFHJGXX(FHJGXX, '飘楼', 2, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 1) MC
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 2) JSXS
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 3) SXH
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 4) CS
             , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 5) SZC
         FROM
             respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 1) MC
             , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 2) JSXS
             , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 3) SXH
             , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 4) CS
             , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '楼梯间', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '楼梯间', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '楼梯间', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '楼梯间', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '楼梯间', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '夹层', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '夹层', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '夹层', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '夹层', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '夹层', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '单柱廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '单柱廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '单柱廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '单柱廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '单柱廊', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '檐廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '檐廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '檐廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '檐廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '檐廊', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '门廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '门廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '门廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '门廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '门廊', 1, 5) SZC
         FROM respyattr
     UNION
         SELECT
             objectid, DCODE
             , ZLFHJGXX(FHJGXX, '挑廊', 1, 1) MC
             , ZLFHJGXX(FHJGXX, '挑廊', 1, 2) JSXS
             , ZLFHJGXX(FHJGXX, '挑廊', 1, 3) SXH
             , ZLFHJGXX(FHJGXX, '挑廊', 1, 4) CS
             , ZLFHJGXX(FHJGXX, '挑廊', 1, 5) SZC
         FROM respyattr)
 WHERE instr(SZC, '.')= 0

一、自然幢赋值

1、赋值居民地小编组号

update respyattr set xbzh = (select groupid from geopy where geopy.objectid = respyattr.objectid)

二、居民地面赋值

1、更新房屋面结构

/*如果后期有修改的可能,则可以考虑采用字典的形式改写*/
UPDATE respyattr set jglx = ZLDICNAME(DCODE,'字典名称') WHERE 1 = 1;
UPDATE
    respyattr
 SET
    JGLX = (
        CASE
            Dcode WHEN '0404000230' THEN 'A'
            WHEN '0404000330' THEN 'C'
            WHEN '0404000730' THEN 'B'
            WHEN '0404000530' THEN 'M'
            WHEN '0404000630' THEN 'E'
            WHEN '0404000830' THEN 'E'
            WHEN '0404000930' THEN 'E'
            WHEN '0404000430' THEN 'E'
        END
    )
 WHERE 1 = 1;

2、赋值默认【复合结构信息】

没有设置【复合结构】内容时,使用默认配置填充。

UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1A全'
                ELSE '1-' || FWCS || 'A全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE  DCODE = '0404000230' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1B全'
                ELSE '1-' || FWCS || 'B全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404000730' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1C全'
                ELSE '1-' || FWCS || 'C全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404000330' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1M全'
                ELSE '1-' || FWCS || 'M全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404000530' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1M全'
                ELSE '1-' || FWCS || 'M全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404000530' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '2飘楼全'
                ELSE '2-' || CAST(
                    FWCS + 1 AS text
                ) || '飘楼全'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404002130' AND FHJGXX IS NULL; 
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '2不封闭阳台半'
                ELSE '2-' || CAST(
                    FWCS + 1 AS text
                ) || '不封闭阳台半'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404010630' AND FHJGXX IS NULL;
UPDATE respyattr
 SET FHJGXX = (
        SELECT
            CASE
                WHEN FWCS IS NULL THEN '1无上盖室外楼梯半'
                ELSE '1-' || FWCS || '无上盖室外楼梯半'
            END
        FROM GEOPY
        WHERE GEOPY.objectid = respyattr.objectid)
 WHERE DCODE = '0404019130' AND FHJGXX IS NULL;

3、赋值【房屋结构名称】

UPDATE
    respyattr
 SET
    FWJGMC = CASE
        JGLX WHEN 'A' THEN '框架'
        WHEN 'B' THEN '混合'
        WHEN 'C' THEN '砖木'
        WHEN 'M' THEN '钢'
        WHEN 'N' THEN '钢、钢混'
    END;

4、赋值【建基面积】

UPDATE
    respyattr
 SET
    sfjsjj = CASE
        WHEN fhjgxx LIKE '1%' THEN '1'
        ELSE 0
    END
 WHERE fhjgxx IS NOT NULL AND ( sfjsjj IS NULL OR sfjsjj = '') ; 
UPDATE
    respyattr
 SET
    jjmj = (
        SELECT
            round(scmj, ZLDICNAME('MJWS','小组配置'))
        FROM geopy
        WHERE geopy.objectid = respyattr.objectid)
 WHERE sfjsjj = '1';
UPDATE respyattr SET jjmj = NULL WHERE sfjsjj = '0';

5、赋值【编号注记】

UPDATE
    respyattr
 SET
    BHZJ = (
        SELECT
            group_concat('<' || BH || '>', '\n')
        FROM
            (SELECT
                    RP.DBZH, t.OBJECTID, t.DCODE, ROW_NUMBER() OVER( PARTITION BY RP.dbzh ORDER BY t.objectid, sxh) BH
                    , GEOPY.FWCS
                    , CASE
                        WHEN MC LIKE 'B%' THEN 'B' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'A%' THEN 'A' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'C%' THEN 'C' || ifnull(GEOPY.FWCS, '')
                        ELSE REPLACE(MC, '1-1', '') END MC
                    , JSXS, SXH, CS, SZC
                    , Round(GEOPY.SCMJ, 4) * (
                        CASE
                            WHEN MC LIKE 'B%'
                            OR MC LIKE 'A%'
                            OR MC LIKE 'C%' THEN ifnull(
                                GEOPY.FWCS, 1)
                            ELSE CS END) * JSXS JZMJ
                FROM
                    (SELECT *
                        FROM
                            (SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 5) SZC
                                FROM
                                    respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, ' 挑廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 5) SZC
                                FROM respyattr)
                        WHERE instr(SZC, '.')= 0) t
                JOIN (
                        SELECT OBJECTID, DBZH FROM respyattr
                    ) RP ON
                    t.objectid = RP.objectid
                JOIN GEOPY ON
                    t.objectid = GEOPY.objectid
                WHERE
                    MC IS NOT NULL
            ) m
        GROUP BY
            objectid
        HAVING
            m.objectid = respyattr.objectid)

6、赋值【注记内容】

UPDATE
    respyattr
 SET
    ZJNR = (
        SELECT
            group_concat(MC, '\n')
        FROM
            (SELECT
                    RP.DBZH, t.OBJECTID, t.DCODE
                    , ROW_NUMBER() OVER(PARTITION BY RP.dbzh ORDER BY t.objectid, sxh) BH
                    , GEOPY.FWCS
                    , CASE
                        WHEN MC LIKE 'B%' THEN 'B' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'A%' THEN 'A' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'C%' THEN 'C' || ifnull(GEOPY.FWCS, '')
                        ELSE REPLACE(MC, '1-1', '') END MC
                    , JSXS, SXH, CS, SZC, Round(GEOPY.SCMJ, 4) * (
                        CASE
                            WHEN MC LIKE 'B%'
                            OR MC LIKE 'A%'
                            OR MC LIKE 'C%' THEN ifnull(GEOPY.FWCS, 1)
                            ELSE CS END) * JSXS JZMJ
                FROM
                    (SELECT *
                        FROM
                            (SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 5) SZC
                                FROM
                                    respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, ' 挑廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 5) SZC
                                FROM respyattr)
                        WHERE instr(SZC, '.')= 0) t
                JOIN (
                        SELECT
                            OBJECTID
                            , DBZH
                        FROM
                            respyattr
                    ) RP ON
                    t.objectid = RP.objectid
                JOIN GEOPY ON
                    t.objectid = GEOPY.objectid
                WHERE
                    MC IS NOT NULL
            ) m
        GROUP BY
            objectid
        HAVING
            m.objectid = respyattr.objectid);

7、赋值阳台飘楼等非主体房屋的【房屋结构名称】

UPDATE
    RESPYATTR
 SET
    FWJGMC = (
        SELECT
            FWJGMC
        FROM
            (
                SELECT
                    DISTINCT XBZH
                    , FWJGMC
                FROM
                    RESPYATTR r2
                WHERE
                    SFJSJJ = 1
                ORDER BY
                    r2.JJMJ DESC
            ) r3
        WHERE
            XBZH = r3.XBZH
    )
 WHERE
    (
        XBZH <> ''
            OR XBZH NOT NULL
    )
    AND SFJSJJ <> 1;

三、宗地赋值

1、相机点信息赋值使用权宗地

通过叠加分析功能赋值。

2、赋值宗地【建筑总面积】

UPDATE syqzdattr
 SET JZZMJ = (
        SELECT
            sum(JZMJ)
        FROM
            (
                SELECT
                    RP.DBZH, t.OBJECTID, t.DCODE, ROW_NUMBER() OVER(PARTITION BY RP.dbzh ORDER BY t.objectid, sxh) BH, GEOPY.FWCS
                    , CASE WHEN MC LIKE 'B%' THEN 'B' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'A%' THEN 'A' || ifnull(GEOPY.FWCS, '')
                        WHEN MC LIKE 'C%' THEN 'C' || ifnull(GEOPY.FWCS, '')
                        ELSE REPLACE(MC, '1-1', '') END MC
                    , JSXS, SXH, CS, SZC
                    , Round(GEOPY.SCMJ, ZLDICNAME('MJWS','小组配置')) 
                    * (CASE WHEN MC LIKE 'B%' OR MC LIKE 'A%' OR MC LIKE 'C%' THEN ifnull(GEOPY.FWCS, 1) ELSE CS END) * JSXS JZMJ
                FROM
                    (
                        SELECT
                            *
                        FROM
                            (
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'C', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'B', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, 'A', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    OBJECTID, DCODE
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX( FHJGXX, '飘楼', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 5) SZC
                                FROM
                                    respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 1) MC
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 4) CS
                                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '夹层', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '门廊', 1, 5) SZC
                                FROM respyattr
                            UNION
                                SELECT
                                    objectid, DCODE
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 1) MC
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 2) JSXS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 3) SXH
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 4) CS
                                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 5) SZC
                                FROM respyattr)
                        WHERE instr(SZC, '.')= 0) t
                JOIN (SELECT OBJECTID, DBZH FROM respyattr) RP ON t.objectid = RP.objectid
                JOIN GEOPY ON t.objectid = GEOPY.objectid
                WHERE MC IS NOT NULL) m
        GROUP BY DBZH HAVING m.DBZH = syqzdattr.objectid);

3、赋值宗地【宗地面积】

UPDATE
    syqzdattr
 SET
    zdmj = (
        SELECT
            round(scmj, ZLDICNAME('MJWS','小组配置'))
        FROM geopy
        WHERE geopy.objectid = syqzdattr.objectid);

4、赋值宗地【无证土地面积,无证建筑面积】

UPDATE
    syqzdattr
 SET
    wztdmj = round(zdmj - ifnull(zztdmj, 0), ZLDICNAME('MJWS','小组配置'));
UPDATE
    syqzdattr
 SET
    wzjzmj = round(jzzmj - ifnull(zzjzmj, 0), ZLDICNAME('MJWS','小组配置'));

5、赋值宗地调查信息

UPDATE SYQZDATTR SET XMMC = ZLDICNAME('XMMC','小组配置') WHERE 1 = 1;
UPDATE SYQZDATTR SET CHDW = ZLDICNAME('CLDW','小组配置') WHERE 1 = 1;
UPDATE SYQZDATTR SET CLR = ZLDICNAME('CLY','小组配置') WHERE CLR IS NULL OR CLR = '';
UPDATE SYQZDATTR SET CLRQ = strftime('%Y%m%d','now') WHERE CLRQ IS NULL OR CLRQ = '';

成果输出相关

一、房屋测量成果图(宗地)

拆迁界址点

1. 与宗地关联关系
SYQZDATTR.OBJECTID = 拆迁界址点.ZD_OID
2. 数据提取语句

表名: 拆迁界址点

SELECT * FROM MBJZDANNPT MB JOIN jzdpt ON MB.JZD_OID = jzdpt.objectid WHERE SFGJD = 1;

拆迁界址线

1. 与宗地关联关系
SYQZDATTR.OBJECTID = 拆迁界址线.ZD_OID
2. 数据提取语句

表名: 拆迁界址线

SELECT * FROM MBJZXANNPT MB JOIN jzXln ON MB.JZX_OID = jzxln.objectid;

白云区建筑面积统计表

1. 与宗地关联关系
SYQZDATTR.OBJECTID = 白云区建筑面积统计表.DBZH
2. 数据提取语句

表名: 白云区建筑面积统计表

SELECT
    RP.DBZH, t.OBJECTID, t.DCODE
    , ROW_NUMBER() OVER(PARTITION BY RP.dbzh
    ORDER BY t.objectid, sxh) BH
    , CASE WHEN SZC LIKE '1%' THEN RP.JJMJ END JJMJ
    , RP.FWJGMC, GEOPY.FWCS
    , CASE
        WHEN MC LIKE 'B%' THEN 'B' || ifnull(GEOPY.FWCS, '')
        WHEN MC LIKE 'A%' THEN 'A' || ifnull(GEOPY.FWCS, '')
        WHEN MC LIKE 'C%' THEN 'C' || ifnull(GEOPY.FWCS, '')
        ELSE REPLACE(MC, '1-1', '') END MC
    , JSXS, SXH, CS, SZC
    , Round(GEOPY.SCMJ, ZLDICNAME('MJWS','小组配置')) 
    * (
        CASE
            WHEN MC LIKE 'B%'
            OR MC LIKE 'A%'
            OR MC LIKE 'C%' THEN ifnull(GEOPY.FWCS, 1) ELSE CS END) * JSXS JZMJ
 FROM
    (SELECT *
        FROM
            (SELECT
                    OBJECTID, DCODE
                    , ZLFHJGXX(FHJGXX, 'C', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, 'C', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, 'C', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, 'C', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, 'C', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    OBJECTID, DCODE
                    , ZLFHJGXX(FHJGXX, 'B', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, 'B', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, 'B', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, 'B', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, 'B', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    OBJECTID, DCODE
                    , ZLFHJGXX(FHJGXX, 'A', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, 'A', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, 'A', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, 'A', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, 'A', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    OBJECTID, DCODE
                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '飘楼', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 1) MC
                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 3) SXH
                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 4) CS
                    , ZLFHJGXX(FHJGXX, '飘楼', 2, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 1) MC
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 3) SXH
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 4) CS
                    , ZLFHJGXX(FHJGXX, '不封闭阳台', 2, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 1) MC
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 3) SXH
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 4) CS
                    , ZLFHJGXX(FHJGXX, '封闭阳台', 2, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '无上盖室外楼梯', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '有上盖室外楼梯', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '楼梯间', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '夹层', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '夹层', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '夹层', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '夹层', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '夹层', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '有柱走廊', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '无柱走廊', 1, 5) SZC
                FROM
                    respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '单柱廊', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '檐廊', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, '门廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '门廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '门廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '门廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '门廊', 1, 5) SZC
                FROM respyattr
            UNION
                SELECT
                    objectid, DCODE
                    , ZLFHJGXX(FHJGXX, ' 挑廊', 1, 1) MC
                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 2) JSXS
                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 3) SXH
                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 4) CS
                    , ZLFHJGXX(FHJGXX, '挑廊', 1, 5) SZC
                FROM respyattr)
        WHERE instr(SZC, '.')= 0) t
 JOIN (
        SELECT
            OBJECTID, DBZH, JJMJ, FWJGMC
        FROM
            respyattr
    ) RP ON
    t.objectid = RP.objectid
 JOIN GEOPY ON t.objectid = GEOPY.objectid
 WHERE MC IS NOT NULL

标签:语句,objectid,MC,SELECT,ZLFHJGXX,FHJGXX,SQL,respyattr,南沙
From: https://www.cnblogs.com/aizhen/p/16607232.html

相关文章

  • Debezium的基本使用(以MySQL为例)
    GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源。GreatSQL是MySQL的国产分支版本,使用上与MySQL一致。一、Debezium介绍摘自官网:Debeziumisa......
  • 借用Linq To SQL,Dapper和自定义实体属性映射构建数据库底层实体和仓储层代码
    这里直接列举核心代码,以后整理:底层引用Dapper。 a1-实体类:usingWebApplication1.DB.Extend;usingWebApplication1.Enum;namespaceWebApplication1.DB.CMS{......
  • docker安装mysql8.0
    dockerrun\-p3306:3306\-eMYSQL_ROOT_PASSWORD=QQ.123\-v/home/data/mysql8/data:/var/lib/mysql:rw\-v/home/data/mysql8/log:/var/log/mys......
  • python操作mysql的应用(重复运行注册用户的接口)
    1.comm里放置数据操作代码2.conftest.py里放置删除用户代码3.test_register.py里放置测试注册用户的代码(运行注册接口之前先从数据库删除注册的账号)  ----------......
  • MYSQL 索引2
    MYSQL索引深入浅出1.1什么是索引(What)1.1.1索引描述索引在搜索引擎优化简单解释指已经被收录且参与关键词排名的页面。索引的通俗解释索引就像是图书......
  • sql-面试题
    TopN问题需要确定使用什么排名函数,包含三种函数:row_number()、rank()、dense_rank()每个班级的分数为前3名的学生--建表语句createtablescore(sidstring,classstr......
  • MySQL传统主从复制
    MySQL传统主从复制为什么要做主从复制做主从复制的目的,并不是为了备份为了解决主库的单点故障为了减少主库的压力(读写分离)复制是MySQL的一项功能,允许服务器将更改从......
  • Mysql事务控制
    事务Transaction并发控制的基本操作可以看成一系列的SQL语句要么成功,要么失败,失败回滚事务特性ACID原子性Atomicity:事务内的操作要么全部成功,要么全部失败一致性C......
  • Canal 过滤/同步 DDL 语句到 MySQL 从库
    canal.deploy配置vimcanal.propertiescanal.serverMode=tcpvimexample/instance.properties#只同步FlinkEtl数据库的数据#tableregexcanal.instance.f......
  • 基于StatefulSet控制器运行MySQL一主多从
      基于StatefulSet的mysql主从架构  下载xtrabackup镜像root@deploy:/dockerfile/project/mysql/pv#dockerpullregistry.cn-hangzhou.aliyuncs.com/liangxiaohu......