[英]SQL Update Statement with WHERE In clause
我在SQL語句中的條件有多余的地方
update ABC_table
set XXX_column = 10
where YYY_column in ('00-0093149',
... upto 700 values)
在Oracle中有更好的方法嗎? 也許類似於“ 超長位置/在語句中-更好的選擇”?
不使用Excel?
謝謝
好吧,您說這些值來自數據庫,即同一表的一列 。
然后,您可以從
update ABC_table
set XXX_column = 10
where YYY_column in ('00-0093149',
... upto 700 values)
至
update ABC_table abcout
set XXX_column = 10
where exists (select null
from ABC_table abcin -- the same table
where abcout.YYY_column = abcin.COLUMN_FOR_THE_SAME_TABLE
/* and maybe some more restrictions here */);
其中COLUMN_FOR_THE_SAME_TABLE
是具有值的列。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.