|
有一个表的结构类似系统组织表,
id1 字段a,字段b,字段c
id2,字段a,字段b,字段c
id2@id1,字段a,字段b,字段c
id2@id3,字段a,字段b,字段c
想要实现更新任何一条id包含id2的记录内容时,同步更新所有包含id2的记录的所有字段。因为字段较多。
尝试方法1,KSQL语句:update table r set (r.a,r.b,r.c)=(select rr.a,rr.b,rr.c from table rr where rr =id2@id1 ) where r like 'id2%' and r <>'id2@id’.
报错:编码: JUSTEP154115; 提示: KSQL语法错误, update r ^^set r.fName=rr.中未找到需要的元素, 位置9期望是<Identifier>
方法2 SQL: update r set r.a=rr.a, r.b=rr.b,r.c=rr.c from table r, table rr where ( r like 'id2%' and r <>'id2@id’) and rr =id2@id1
报错:Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from table r, table rr where ( r like id2% an' at line 1
请教下这样的需求该怎么写?
|
|