[英]Matching a TEXT or Alphanumber value from one column to the values of a different column in SQL Server
I have to see if there is a match of values from Column A with the Column B of a different table.我必须查看 A 列中的值与不同表的 B 列中的值是否匹配。 Below is an example I have listed,
下面是我列出的一个例子,
CUSTOMER # Column A Table A CUSTOMER # Column A Table B
11111 TO BE 12345 ,XXXX,TO BE,/TO BE/
I could have it right below as well if it makes it easier, (Same Table but different column,如果它更容易,我也可以将它放在下面,(相同的表但不同的列,
CUSTOMER # Column A Table A CUSTOMER # Column B Table A
11111 TO BE 11111 ,XXXX,TO BE,/TO BE/
So going through 30,000 records, I have to show the customer # for every match and the match itself.因此,通过 30,000 条记录,我必须显示每场比赛的客户编号以及比赛本身。
So, the result would be two things, one insert the Customer # and TO BE to a separate Column called Column C. and also a listing that shows the Customer # and the TO BE Text.因此,结果将是两件事,一是将 Customer # 和 TO BE 插入到名为 Column C. 的单独列中,另外还有一个显示 Customer # 和 TO BE 文本的列表。
Please help!!!请帮忙!!!
You need JOIN
(i think) :你需要
JOIN
(我认为):
SELECT a.customer, a.columnA as [column a from a], b.customer, b.columnA as [column a from b]
FROM tableA a INNER JOIN
tableB b
ON b.customer = a.customer;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.