Hassle-free live chat software re-imagined for business growth. 2 users, always free.
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
|generate script create schema without authorization with smo||3||30|
|Get Duration of last Status Update||4||31|
|Split one comma delimited string in a column into 7 (SQL server 2008)||13||65|
|Adware on IIS hosted asp.net website||1||17|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
14 Experts available now in Live!