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

找出兩列之間的差異

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

問題描述

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

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

假設我有如下所示的數據:

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 中的內容,以便我有一列如下所示:

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 查詢發送報告,任務是顯示 列 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 查詢目前在結果中的樣子.

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

編輯 #2:

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

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.

我正在嘗試創建 column C 以顯示差異.

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

編輯 #3:

Column A 來自一個數據源Column B 來自另一個數據源.

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

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

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

相關文檔推薦

Modify Existing decimal places info(修改現有小數位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號或管道運算符字符串中刪除重復項)
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 欧美一二区| 欧美片网站免费 | 日韩在线免费 | 欧美一区二区三区四区五区无卡码 | 99re在线| 色综合欧美 | 亚洲一区二区免费看 | 色婷婷亚洲国产女人的天堂 | www.99精品| 国产男女视频 | 欧美99| 手机在线观看 | 久久91精品久久久久久9鸭 | 欧美视频二区 | 久艹网站 | 精品欧美一区二区精品久久久 | 国产中文字幕在线观看 | a毛片 | 欧美性网 | 在线观看成人免费视频 | 狠狠干影院 | 黄色大片免费看 | 男人天堂网址 | 精品99久久久久久 | 精品亚洲一区二区三区 | 久久不射电影网 | 亚洲不卡在线观看 | 精品欧美激情在线观看 | 91大神新作在线观看 | 亚洲成人久久久 | 亚洲高清电影 | 7777精品伊人久久精品影视 | 成人伊人| 在线日韩精品视频 | 亚洲一区二区av在线 | 午夜激情在线视频 | 国产精品不卡一区 | 黄色91在线| 成人在线视频免费看 | 欧州一区二区三区 | 国外成人在线视频网站 |