本文介紹了僅更新具有共享/相似值的行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
好的 - 我有一個簡單的表格 - 下面 - 我想要做的是只識別那些具有共享值的行 - 所以任何具有共享apc"值的東西 - DO x else Do Y
OK - I have a simple table - below - what I am trying to do is to identify only those rows that have a shared value - so anything that has a shared "apc" value - DO x else Do Y
CREATE TABLE #test (hcpcs varchar(10), apc varchar(100), rate money)
INSERT INTO #test (hcpcs, apc)
SELECT '97110', '8009'
UNION ALL
SELECT '71020', '8009'
UNION ALL
SELECT '85025', '8006'
因此 - 從上面 - 所有那些共享8009"的行 - 我將這些行用于更新 - 它們將共享相同的速率".帶有8006"的行不會成為該更新的一部分
So - from the above - all those rows that share "8009" - I will gram those rows for an update - they will share the same "rate". Row with "8006" will not be a part of that update
推薦答案
您想要:
WHERE EXISTS (SELECT *
FROM #test t2
WHERE t2.apc = #test.apc
AND t2.hcpcs != #test.hcpcs)
確保將 apc
編入索引,以便有效地完成此操作.
Make sure apc
is indexed so that this can be done effectively.
這篇關(guān)于僅更新具有共享/相似值的行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!