首页 > 代码库 > sybase update
sybase update
Using the wrong join condition in a FROM clause causes unpredictable results. If the FROM clause specifies a one-to-many join and the SET clause references a cell from the “many” side of the join, the cell is updated from the first value selected. In other words, if the join condition causes multiple rows of the table to be updated per row id, the first row returned becomes the update result. For example:
UPDATE T1 SET T1.c2 = T2.c2FROM T1 JOIN TO T2ON T1.c1 = T2.c1
If table T2 has more than one row per T2.c1, results might be as follows:
T2.c1 T2.c2 T2.c3
1 4 3
1 8 1
1 6 4
1 5 2
With no ORDER BY clause, T1.c2 may be 4, 6, 8, or 9.
With
ORDER BY T2.c3
, T1.c2 will be updated to 8.With
ORDER BY T2.c3 DESC
, T1.c2 will be updated to 6.
sybase update
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。