I work on SQL server 2012 I face issue I can't get Active Parts for Obsolete Parts
create table #Replacement ( PartIDC INT, PartIDX INT ) insert into #Replacement (PartIDC,PartIDX) values (1222,3421), (3421,5643), (5643,2243), (2243,3491) create table #LifeCycleMaster ( ZpartId int, Zlc int ) insert into #LifeCycleMaster (ZpartId,Zlc) values (1222,2000), (3421,2000), (5643,2000), (2243,2000), (3491,2001) Create table #acceptedvalues ( acceptedvaluesid int, acceptedvaluesname nvarchar(50) ) insert into #acceptedvalues values (2000,'Obsolete'), (2001,'Active')
I get first Part Obsolete so when get first Part Obsolete will be 1222
then I search for active Part for obsolete Part 1222 on Part X i found it not on same row
but I found it on row number 4 and value on it on Part X as 3491 as Active
so How to do that ?
Expected Result :
PartIDX PartIDC 1222 3491