Table1

id Name
1 xxx
2

ooo

Table2

Table1Id Table1Name Column1 Column2 Column3
1 sss xxxx xxxx xxxx
2 ddd xxxx xxxx xxxx
2 ddd xxxx xxxx xxxx

更新Table1的Name到Table2

/*
* Update t2
* Set t2.Table1Name = t1.Name
* From Table2 t2
* Join Table1 t1 on t1.Id = t2.Table1Id
* Where t1.Name <> t2.Table1Name
*/
// 兩個table沒有創建foreign key, 需要先create custom relation
EntityRelation entityRelation = new EntityRelation(Table1Fields.Id, Table2Fields.Table1Id, RelationType.OneToMany); IRelationCollection relation = new RelationCollection();
relation.Add(entityRelation, JoinHint.Inner); IPredicateExpression filter = new PredicateExpression();
filter.Add(Table2Fields.Table1Name != Table1Fields.Name); Table2Entity updater = new Table2Entity();
updater.Fields[(int)Table2FieldIndex.Table1Name].ExpressionToApply = new Expression(Table1Fields.Name); Table2Collection updatedCollection = new Table2Collection();
updatedCollection.UpdateMulti(updater, filter, relation);

LLBLGen update table with join的更多相关文章

  1. Can't update table 'test_trigger' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

    [Err] 1442 - Can't update table 'test_trigger' in stored function/trigger because it is already used ...

  2. MySql Error: Can't update table in stored function/trigger

    MySql Error: Can't update table in stored function/trigger because it is already used by statement w ...

  3. SQL UPDATE with INNER JOIN

    mysql - SQL UPDATE with INNER JOIN - Stack Overflowhttps://stackoverflow.com/questions/14491042/sql- ...

  4. MySQL触发器更新本表数据异常:Can't update table 'tbl' in stored function/trigger because it

    MySQL触发器更新本表数据异常:Can't update table 'tbl' in stored function/trigger because it 博客分类: 数据库 MySQLJava ...

  5. Can’t update table ‘xxx’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger

    MySQL: Solution for ERROR 1442 (HY000): Can't update table 'xxx' in stored function/trigger because ...

  6. Delete,Update与LEFT Join

    UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyB ...

  7. update使用inner join

    一.update 基础语法 UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 上面是我们常见的更新表的方式,其实我们还可以去另外一张表的数据来更新当前的表数据,如现在就有这 ...

  8. MySQL - 问题集 - 触发器更新本表数据异常"Can’t update table ‘tbl’ in stored function/trigger because it is already used by statement which invoked this"

    如果你在触发器里面对刚刚插入的数据进行了 insert/update, 则出现这个问题.因为会造成循环的调用. create trigger test before update on test fo ...

  9. 【sql技巧】mysql修改时,动态指定要修改的字段 update `table` set (case when ....) = 1 where id = xx

    如果你点进了这篇帖子,那么你一定遇到了跟我一样的问题.别看题目的set case when...,我一开始也是第一反应是用case when但是发现并不好使. 问题呢,说得高大上一点:动态指定要修改的 ...

随机推荐

  1. 聊聊ThreadLocal源码(基于JDK1.8)

    原文:https://cloud.tencent.com/developer/article/1333298 聊聊JDK源码中ThreadLocal的实现 主要方法: ThreadLocal的get方 ...

  2. Python常用标准库函数

    math库: >>> import math >>> dir(math) ['__doc__', '__loader__', '__name__', '__pack ...

  3. postgres高可用学习篇一:如何通过patroni如何管理3个postgres节点

    环境: CentOS Linux release 7.6.1810 (Core) 内核版本:3.10.0-957.10.1.el7.x86_64 node1:192.168.216.130 node2 ...

  4. 51nod1423 最大二“货”

    [传送门] 单调栈其实就是个后缀$max/min$,这道题可以维护一个单调递减的单调栈,pop元素的时候,能pop掉的元素就是第二大,当前元素为第一大.遇到第一个不能pop掉的时候当前元素就是第二大, ...

  5. LightOJ - 1318 - Strange Game(组合数)

    链接: https://vjudge.net/problem/LightOJ-1318 题意: In a country named "Ajob Desh", people pla ...

  6. (尚027)Vue_案例_交互添加

    TodoHeader.vue组件 写交互: 第一步:跟目标元素绑定监听 (1).按回车键确认@keyup.enter="add" (2). 注意:数据在哪个组件,更新数据的行为就应 ...

  7. 解决Ubuntu系统下 mysql 远程连接失败的问题 ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xx.xx' (110)

    如果远程连不上mysql.cnf 里面也修改了:bind注销掉了127.0.0.1 等所有的 但是telnet xxx.xxx.xx.xx 3306 端口 不通:那么 就是防火墙的问题了 1.修改Ub ...

  8. [USACO14MAR] Sabotage 二分答案 分数规划

    [USACO14MAR] Sabotage 二分答案 分数规划 最终答案的式子: \[ \frac{sum-sum[l,r]}{n-len[l,r]}\le ans \] 转换一下: \[ sum[1 ...

  9. “知乎杯”2018 CCF 大学生计算机系统与程序设计竞赛 绝地求生(battleground)

    /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-ts ...

  10. 洛谷 P2085 最小函数值

    目录 题目 思路 \(Code\) 题目 戳 思路 首先这些函数全部单带递增,因为\(a\),\(b\),\(c\)都是正整数. 我们将全部的函数的\(x\)为\(1\)时的函数值放入优先度列(小根堆 ...