LLBLGen update table with join
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的更多相关文章
- 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 ...
- 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 ...
- SQL UPDATE with INNER JOIN
mysql - SQL UPDATE with INNER JOIN - Stack Overflowhttps://stackoverflow.com/questions/14491042/sql- ...
- 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 ...
- 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 ...
- Delete,Update与LEFT Join
UPDATE:UPDATE A SET ApproverID=NULL FROM [SH_MaterialApplyBuyBill] A LEFT JOIN [SH_MaterialApplyBuyB ...
- update使用inner join
一.update 基础语法 UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值 上面是我们常见的更新表的方式,其实我们还可以去另外一张表的数据来更新当前的表数据,如现在就有这 ...
- 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 ...
- 【sql技巧】mysql修改时,动态指定要修改的字段 update `table` set (case when ....) = 1 where id = xx
如果你点进了这篇帖子,那么你一定遇到了跟我一样的问题.别看题目的set case when...,我一开始也是第一反应是用case when但是发现并不好使. 问题呢,说得高大上一点:动态指定要修改的 ...
随机推荐
- KMP算法的时间复杂度与next数组分析
一.什么是 KMP 算法 KMP 算法是一种改进的字符串匹配算法,用于判断一个字符串是否是另一个字符串的子串 二.KMP 算法的时间复杂度 O(m+n) 三.Next 数组 - KMP 算法的核心 K ...
- sql null+字符=null
哦,谢谢你,我还想问一个declare @temp varchar(10),@identity varchar(10),@sura varchar(10),@p int,@len int,@nod1 ...
- 深入详解JVM内存模型
JVM内存结构 由上图可以清楚的看到JVM的内存空间分为3大部分: 堆内存 方法区 栈内存 其中栈内存可以再细分为java虚拟机栈和本地方法栈,堆内存可以划分为新生代和老年代,新生代中还可以再次划分为 ...
- django-登录和退出及redis存储session信息
登录 1.视图函数views.py # 登录 from django.contrib.auth import authenticate, login # authenticate:user认证 log ...
- JSON和计算机网络的个人总结
JSON JSON是什么? JSON:JavaScript Object Notation, JS 对象简谱) 是一种轻量级的数据交换格式.它基于ECMAScript (欧洲计算机协会制定的js规范) ...
- tornado处理跨域问题
报错信息一: Access to XMLHttpRequest at 'http://localhost:4445/api/v/getmsg' from origin 'http://localhos ...
- BZOJ 1758: [Wc2010]重建计划 01分数规划+点分治+单调队列
code: #include <bits/stdc++.h> using namespace std; #define setIO(s) freopen(s".in", ...
- Selenium ChromeDriver与Chrome版本映射表(更新到v77)
ChromeDriver版本 支持的Chrome版本 v77.0.3865.40 v77 v76.0.3809.126 v76 v75.0.3770.140 v75 v74 v74 v73 v73 v ...
- 2019.12.09 java for循环
for(初始化表达式; 循环条件; 操作表达式){ 执行语句 ……… } 先走初始化表达式,再走循环条件,如条件满足,走执行语句,然后走操作表达式,再走循环条件,如条件满足,走执行语句 ...
- rep stos dword ptr es:[edi]
本文链接:https://blog.csdn.net/ypist/article/details/8467163今天读代码时,忽然跳出如下一条指令==>>汇编代码: rep stos dw ...