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. Oid 类

    参考地址:https://docs.microsoft.com/zh-cn/dotnet/api/system.security.cryptography.oid?redirectedfrom=MSD ...

  2. Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't

    在使用真机定位页面元素时启动uiautomatorviewer.bat ,报错Error while obtaining UI hierarchy XML file: com.android.ddml ...

  3. CSP-S 2019提高组训练 服务器需求

    时间限制:C/C++ 3秒 空间限制:C/C++ 262144K 题目描述 小多计划在接下来的n天里租用一些服务器,所有的服务器都是相同的.接下来n天中,第i天需要\(a_i\)台服务器工作,每台服务 ...

  4. 20199301《Linux内核原理与分析》第十一周作业

    Linux Capability探索实验 一.实验描述 本实验中,将感受到linux capability功能在访问控制上的优势,掌握使用Capability达到遵守最小权限原则的目的,并分析linu ...

  5. JAVA项目部署(1)

    之前小菜觉得项目发布啊部署可难了,今个儿小菜接有幸触了一下java项目的打包和部署,没上手前觉得可高大上了,可难了,小菜这人就是做没做过的事前特别喜欢自己吓唬自己,这个习惯不好,得改!其实自己真正动手 ...

  6. Go语言 - 指针 | new | make

    区别于C/C++中的指针,Go语言中的指针不能进行偏移和运算,是安全指针. 要搞明白Go语言中的指针需要先知道3个概念:指针地址.指针类型和指针取值. 概念 任何程序数据载入内存后,在内存都有他们的地 ...

  7. python的next()函数

    next(iterobject,defalt)函数的第一个参数是一个可迭代对象,第二个参数可以不写.不写的时候,如果可迭代对象的元素取出完毕,会返回StopIteration.如果第二个参数写一个其他 ...

  8. [ARIA] Add aria-expanded to add semantic value and styling

    In this lesson, we will be going over the attribute aria-expanded. Instead of using a class like .op ...

  9. AJax的三种响应

    AJax的响应 1.普通文本方式(字符串) resp.getWriter().print("你好"); 2.JSON格式当要给前台页面传输 集合或者对象时 使用普通文本传输的时St ...

  10. c++合并两个序列函数merge()和inplace_merge()

    大家在写归并排序时是不是觉得合并两个序列有点麻烦,有快速的方法吗? 我们全部函数自己写,比如: #include<bits/stdc++.h> using namespace std; # ...