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

找出兩列之間的差異

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

問題描述

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

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:

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

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:

表格中的每個(gè)記錄/列交叉點(diǎn)沒有多個(gè)值.為了讓最終用戶更容易查看報(bào)告,我在交集中放置了多個(gè)值,在我的 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 來自一個(gè)數(shù)據(jù)源Column B 來自另一個(gè)數(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.

推薦答案

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

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)
主站蜘蛛池模板: 国产精品久久久久久久久久久久午夜片 | 成年人免费看视频 | heyzo在线观看| 日韩a级片| 神马福利视频 | 日韩毛片网 | 日韩精品在线观看视频 | 亚洲精品1区2区 | 日韩欧美精品一区二区 | 欧美一级欧美三级在线观看 | 黄色一集片 | 天天射日日干 | 天天干少妇| 99国产精品99久久久久久 | 91麻豆精品国产91久久久久久 | 久久综合五月天 | 中文字幕第一页在线 | 91在线精品秘密一区二区 | 91久久久精品 | 国产小视频在线播放 | 久久精品一区二区三区四区 | 日韩高清精品免费观看 | 性久久久久久久 | 中文字幕在线观看一区二区三区 | 国产99对白在线播放 | 亚洲综合在线播放 | 天天操一操 | a视频| 成人三级视频在线观看 | 国产精品亚洲综合 | 黄色大片在线免费观看 | 亚洲黄色大片 | 成人免费av | 欧美亚洲国产精品 | 色综合av | 久久亚洲免费视频 | 欧美国产一区二区 | 日韩综合久久 | 国产日韩欧美综合 | 久久久久久综合 | 国产精品久久久久久久久免费桃花 |