USE tempdb for GO IF OBJECT_ID (' dbo. [t]) IS NOT NULL DROP TABLE dbo. [t] GO The CREATE TABLE dbo. [t] ( [bom_no] NVARCHAR (MAX) , name_c NVARCHAR (MAX) , name_w NVARCHAR (MAX) ) GO SET NOCOUNT ON INSERT INTO dbo. [t] VALUES (N 'B1210000003 - & gt; ', N 'FPA - PVL100201', N 'SSD253455') INSERT INTO dbo. [t] VALUES (N 'C1130050010 - & gt; ', N 'P650XS2I0-01', N 'FPA - PVL100201') INSERT INTO dbo. [t] VALUES (N 'C1130050410 - & gt; ', N 'PVL1003-01', N 'FPA - PVL100201') - above table for the test data and test -
SELECT A. *, b. [name_w] The FROM t AS A INNER JOIN t AS B ON a. [name_w]=B.n ame_c
CodePudding user response:
I reckon this problem won't be so simple, could be LEFT JOIN many times, and the difficulty in don't know whether to be LEFT JOIN several times