Sorry Guys. Just modified the sample DDL based on actual data. thanks.
Create table #Sample2 --Main Table
( IdNum nvarchar(35), itemID nvarchar(35), Line nvarchar(35))
Insert into #sample2(IdNum,itemID,line) values('TRP005196603','SKU001','Line1')
Insert into #sample2(IdNum,itemID,line) values('TRP005207420','SKU002','Line2')
Insert into #sample2(IdNum,itemID,line) values('TRP005207421','SKU003','Line3')
Insert into #sample2(IdNum,itemID,line) values('TRP005207420','SKU002','Line2')
Insert into #sample2(IdNum,itemID,line) values('TRP005224362','SKU004','Line3')
Create table #sample
(Item nvarchar(35), IdNum nvarchar(35))
Insert into #sample(Item,IdNum ) values('MAT3748','TRP005196603')
Insert into #sample(Item,IdNum) values('MAT3751','TRP005196603')
Insert into #sample(Item,IdNum) values('TX3001710DR','TRP005196603')
Insert into #sample(Item,IdNum) values('FRU300DRD','TRP005207420')
Insert into #sample(Item,IdNum) values('MAT3745','TRP005207420')
Insert into #sample(Item,IdNum) values('MAT3748','TRP005207420')
Insert into #sample(Item,IdNum) values('FRUA300DRD','TRP005207421')
Insert into #sample(Item,IdNum) values('MAT3771','TRP005207421')
Insert into #sample(Item,IdNum) values('MAT3774','TRP005207420')
Insert into #sample(Item,IdNum) values('MAT3824','TRP005207420')
Insert into #sample(Item,IdNum) values('MAT3977','TRP005207420')
Insert into #sample(Item,IdNum) values('CRR3000412iPH5','TRP005224362')
No comments:
Post a Comment