Access中Update inner join set a=b 用法时间:2022-11-20 22:32:27DatabaseWrapper dbWrap = new DatabaseWrapper(outputMdbPath); string x = ""; List<string> SQLList = new List<string>(); SQLList.Clear(); //获取新增建设用地 string xzjsyd = "'水田','水浇地','旱地','园地','林地','牧草地','设施农用地','农村道路','坑塘水面','农田水利用地','田坎','河流水面','湖泊水面','滩涂','自然保留地'"; x = "create table xzjsyd_xp(bsm_1 INTEGER,dlmj double) "; SQLList.Add(x); x = "insert into xzjsyd_xp(bsm_1,dlmj) select bsm_1,sum(tbdlmj_xp)*0.0001 as dlmj from " + outRegTableName + " where dlmc in(" + xzjsyd + ") group by bsm_1 "; SQLList.Add(x); x = "update " + Name_Mzzdjsxm + " a inner join "; x += " xzjsyd_xp b "; x +=" on a.bsm=b.bsm_1 set a.XZJSYD=b.dlmj"; SQLList.Add(x); //获取建设占用耕地 string jszygd = "'水田','水浇地','旱地'"; x = "create table jszygd_xp(bsm_1 INTEGER,dlmj double) "; SQLList.Add(x); x = "insert into jszygd_xp(bsm_1,dlmj) select bsm_1,sum(tbdlmj_xp)*0.0001 as dlmj from " + outRegTableName + " where dlmc in(" + jszygd + ") group by bsm_1 "; SQLList.Add(x); x = "update " + Name_Mzzdjsxm + " a inner join "; x += " jszygd_xp b "; x +=" on a.bsm=b.bsm_1 set a.JSZYGD=b.dlmj"; SQLList.Add(x); //----- x = "Create Table ZdjsxmDataMeasureResult(XMLXDM Text(2),XMMC Text(100),JSXZDM Text(2),JSNX Text(10),YDZGM double,XZJSYD double,JSZYGD double,SJCZ Text(200),MS Text(255))"; SQLList.Add(x); x = "insert into ZdjsxmDataMeasureResult(XMLXDM,XMMC,JSXZDM,JSNX,YDZGM,XZJSYD,JSZYGD,SJCZ,MS) "; x += " select XMLXDM,XMMC,JSXZDM,JSNX,sum(YDZGM) as YDZGM,sum(XZJSYD) as xzjsyd,sum(JSZYGD) as jszygd,SJCZ,MS "; x += " from " + Name_Mzzdjsxm + " "; x += " group by XMLXDM,XMMC,JSXZDM,JSNX,sjcz,ms "; SQLList.Add(x); //执行SQL语句 for (int i = 0; i < SQLList.Count; i++) { dbWrap.DB.ExecuteQuery(CommandType.Text, SQLList[i]); } dbWrap.Dispose(); dbWrap = null; Access中Update a inner join b on a.2=b.2 set a.1=b.1 用法 a,b表必须是实体表,实实在在的在数据库中存在的表!