连接两个字段用 的 是 || ,如果用 + 则是正常的数学运算
ALTER TABLE Ndchange add xzcod char(10)
向表中插入空白列
UPDATE Ndchange SET xzcod = SUBSTR("变更后座落代码",1,9) WHERE 变更后座落代码 !=''
substr(str1,起始位置,长度)
UPDATE Ndchange SET xzcod = ''
某列置空
SELECT xzcod,变更前地类编码,变更后地类编码,round(sum(变更面积减少)/10000*0.0015,4) FROM Ndchange WHERE 变更前地类编码 LIKE'01%' GROUP BY xzcod,变更前地类编码,变更后地类编码
SELECT xzcod,变更后地类编码,round(sum(变更面积减少)/10000*0.0015,4) FROM Ndchange WHERE 变更前地类编码 LIKE'01%' AND 变更后地类编码 !='010%' GROUP BY xzcod,变更前地类编码,变更后地类编码
UPDATE Ndchange SET Xcod = SUBSTR("变更后座落代码",1,13) || "变更后图斑编号" WHERE 变更后座落代码 !=''
UPDATE 恢复属性 SET Xcode = SUBSTR("ZLDWDM",1,13) || "TBBH" WHERE ZLDWDM !=''
SELECT * FROM Ndchange WHERE Xcod = '5107271002120242'
UPDATE Ndchange SET Hfsx = (SELECT HFtab.ZZSXDM FROM HFtab WHERE Ndchange.Xcod = HFtab.Xcode) WHERE Ndchange.Xcod IN (SELECT Xcode FROM HFtab)
根据 xcod 和 xcode (字段值相同) 提取种植属性到 恢复属性
UPDATE Ndchange SET Edpdj = (SELECT Edgd.GDPDJ FROM Edgd WHERE Ndchange.Excod = Edgd.Excode) WHERE Ndchange.Excod IN (SELECT Excode FROM Edgd)
UPDATE Ndchange SET 变更后耕地坡度级别 = (SELECT Gxhgd.GDPDJB FROM Gxhgd WHERE Ndchange.Xcod = Gxhgd.Xcode) WHERE Ndchange.Xcod IN (SELECT Xcode FROM Gxhgd)
查询举证
SELECT JZRY,COUNT(*) FROM "TYSDJZ" WHERE JZRY !='' GROUP BY JZRY