We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
declare @Seek as varchar(20) set @seek = 'AR42154' select * from amipartnumbers as APN left join ( select * from JD cross apply ( values (1, OEMPartNumer ) ,(2, OEMSubNumber ) ,(3, OEMSubNumber2) --,(4, OEMSubNumber3) --,(5, OEMSubNumber4) ) as xapply (lvl, OEMRef) ) JDT on APN.OEMItem = JDT.OEMRef where OEMPartNumer = @Seek or OEMSubNumber = @seek or OEMSubNumber2 = @seek --or OEMSubNumber3 = @seek --or OEMSubNumber4 = @seek
UPDATE imports SET imports.AMIPartNumber = coalesce(AMIA.Item,AMIB.Item,AMIC.Item,AMID.Item,AMIE.Item), Imports.AMIDescription = coalesce(AMIA.Description,AMIB.Description,AMIC.Description,AMID.Description,AMIE.Description) FROM imports as I LEFT JOIN JD as JDA ON I.OEMPartNumber = JDA.OEMPartNumber LEFT JOIN amipartnumbers as AMIA ON JDA.OEMPartNumber = AMIA.OEMItem LEFT JOIN JD as JDB ON I.OEMPartNumber = JDB.OEMSubNumber LEFT JOIN amipartnumbers as AMIB ON JDB.OEMSubNumber = AMIB.OEMItem LEFT JOIN JD as JDC ON I.OEMPartNumber = JDC.OEMSubNumber2 LEFT JOIN amipartnumbers as AMIC ON JDB.OEMSubNumber2 = AMIC.OEMItem LEFT JOIN JD as JDD ON I.OEMPartNumber = JDD.OEMSubNumber3 LEFT JOIN amipartnumbers as AMID ON JDB.OEMSubNumber2 = AMID.OEMItem LEFT JOIN JD as JDE ON I.OEMPartNumber = JDE.OEMSubNumber4 LEFT JOIN amipartnumbers as AMIE ON JDB.OEMSubNumber2 = AMIE.OEMItem ; select * from imports
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.