Files
lst/lstV2/server/services/sqlServer/querys/dm/bulkOrderArticleInfo.ts

28 lines
726 B
TypeScript

export const bulkOrderArticleInfo = `
SELECT
x.HumanReadableId as av
,x.Name
,Alias
,CustomerDescription
,CustomerArticleNumber
,LoadingUnitPieces
,LoadingUnitsPerTruck
,LoadingUnitPieces * LoadingUnitsPerTruck as totalTruckLoad
FROM [test1_AlplaPROD2.0_Read].[masterData].[Article] (nolock) as x
--get the sales price stuff
left join
(select * from (select *
,ROW_NUMBER() OVER (PARTITION BY articleId ORDER BY validAfter DESC) as rn
from [test1_AlplaPROD2.0_Read].[masterData].[SalesPrice] (nolock))as b
where rn = 1) as s on
x.id = s.ArticleId
-- link pkg info
left join
[test1_AlplaPROD2.0_Read].[masterData].[PackagingInstruction] (nolock) as p on
s.PackagingId = p.id
where x.HumanReadableId in ([articles])
`;