久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

找出兩列之間的差異

Finding the Differences Between 2 Columns(找出兩列之間的差異)
本文介紹了找出兩列之間的差異的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我不確定這個問題的標(biāo)題是什么,但如果你有更好的主意,請隨時編輯它.

I wasn't sure what to title this question, but feel free to edit it if you have a better idea.

假設(shè)我有如下所示的數(shù)據(jù):

Let's say I have data that looks like this:

Column A                         Column B
John, Sally, Cindy               John, Sally, Cindy, Steve
John, Cindy                      John, Sally, Cindy
Sally, Cindy                     Sally, Cindy
Sally, Steve                     John, Sally, Steve

我想做的是找出差異.我想查看 column B 中存在哪些不在 column A 中的內(nèi)容,以便我有一列如下所示:

What I would like to do is find the differences. I want to see what exists in column B that are not in column A, so that I have a column that looks like this:

Column C
Steve
Sally
''
John

對此有什么建議嗎?

編輯 #1:

表格不是這樣存儲的,表格每個單元格沒有多個值;但是,我從 SQL 查詢發(fā)送報(bào)告,任務(wù)是顯示 列 a 和 b 具有多個這樣的值的差異.

The table is not stored like this, the table does not have multiple values per cell; however, I am sending a report from a SQL query and the assignment is to show the differences with columns a and b having multiple values like this.

這是我的 SQL 查詢目前在結(jié)果中的樣子.

This is what my SQL query currently looks like in the results so far.

編輯 #2:

表格中的每個記錄/列交叉點(diǎn)沒有多個值.為了讓最終用戶更容易查看報(bào)告,我在交集中放置了多個值,在我的 SQL 查詢結(jié)果中,以便顯示存在和不存在的內(nèi)容.

There are not multiple values per record/column intersection in the table. To make the report easier to view for the end user, I placed multiple values in the intersection, in my SQL Query Results, so show what is there and what is not there.

我正在嘗試創(chuàng)建 column C 以顯示差異.

I am trying to create column C to show the differences.

編輯 #3:

Column A 來自一個數(shù)據(jù)源Column B 來自另一個數(shù)據(jù)源.

Column A comes from one data source Column B comes from another data source.

A 和 B 不是彼此的子集,我只是選取 2 列并嘗試以更簡單的方式找出差異.

A and B are not subsets of each other, I am simply taking 2 columns and trying to find the differences in an easier way.

推薦答案

不清楚是否要將多個差異聚合到一個分隔單元格中.

Not clear if you want multiple differences aggregated into one delimited cell.

示例

Declare @YourTable table (ColA varchar(150),ColB varchar(150))
Insert Into @YourTable values 
('John, Sally, Cindy','John, Sally, Cindy, Steve'),
('John, Cindy','John, Sally, Cindy'),
('Sally, Cindy','Sally, Cindy'),
('Sally, Steve','John, Sally, Steve')

Select A.*
      ,B.*
 From  @YourTable A
 Outer Apply (
                Select Diff=value
                 From (
                        Select value=ltrim(rtrim(value)) From string_split(ColA,',')
                        Union All
                        Select value=ltrim(rtrim(value)) From string_split(ColB,',')
                      ) B1
                  Group By Value
                  Having count(*)=1
             ) B

退貨

ColA                ColB                        Diff
John, Sally, Cindy  John, Sally, Cindy, Steve   Steve
John, Cindy         John, Sally, Cindy          Sally
Sally, Cindy        Sally, Cindy    
Sally, Steve        John, Sally, Steve          John

這篇關(guān)于找出兩列之間的差異的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Modify Existing decimal places info(修改現(xiàn)有小數(shù)位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關(guān)名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號或管道運(yùn)算符字符串中刪除重復(fù)項(xiàng))
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關(guān)系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 久精品久久 | www.精品一区 | 日韩成人久久 | 欧美精品一 | 激情91 | 国产精品久久在线观看 | 九九热在线视频观看这里只有精品 | 一级欧美| 国产精品第2页 | 9191在线播放 | 香蕉视频1024 | 黄色免费网 | 91在线视频免费观看 | 337p日本欧洲亚洲大胆鲁鲁 | 欧美视频一区 | 久久国产精品久久久久 | 中文字幕视频在线观看免费 | 久久久久久久久久久久91 | 欧美成视频 | 久久久精品网站 | 日韩精品av| 国产在线a | 超碰在线观看97 | 一区二区三区日韩 | 成人亚洲片 | 91精品一区二区三区久久久久久 | 午夜精品久久久久久久久久久久 | 欧美黑人一区 | 久久99久久98精品免观看软件 | 精品中文字幕在线观看 | 国产成人网 | 亚洲成av片人久久久 | 日韩视频―中文字幕 | 亚洲精品乱码久久久久久按摩观 | 麻豆精品国产91久久久久久 | 久久久在线视频 | 毛片视频免费 | 精品欧美| 美国一级黄色片 | 国产成人免费视频网站视频社区 | 久久久精品 |