Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Prezados, boa tarde!
Possuo duas tabelas sendo 1 de custo (cost) e a outra de vendas (sales). Eu necessito ligar essas duas tabelas onde o resultado esperado é o que está logo abaixo. (caso não tenha custo naquela data trazer sempre o último custo).
Cost:
LOAD SkuCost,Cost,Date INLINE [
SkuCost,Cost,Date
SKU1, 10, 2013-01-13
SKU1, 11, 2013-07-01
SKU1, 12, 2013-11-09
SKU2, 20, 2013-01-15
SKU2, 21, 2013-11-20
];
Sales:
LOAD SkuSale,Value,DateSale INLINE [
SkuSale,Value,DateSale
SKU1, 15, 2013-01-13
SKU1, 15, 2013-01-15
SKU1, 16, 2013-01-16
SKU1, 15, 2013-01-17
SKU1, 13, 2013-06-02
SKU1, 14, 2013-07-03
SKU1, 16, 2013-12-28
SKU2, 20, 2013-01-15
SKU2, 20, 2013-01-16
SKU2, 20, 2013-01-20
SKU2, 20, 2013-11-20
SKU2, 21, 2013-11-21
];
/*
the expected result would be
SkuSale,Value,DateSale, CostSale
SKU1, 15, 2013-01-13, 10
SKU1, 15, 2013-01-15, 10
SKU1, 16, 2013-01-16, 10
SKU1, 15, 2013-01-17, 10
SKU1, 13, 2013-06-02, 10
SKU1, 14, 2013-07-03, 11
SKU1, 16, 2013-12-28, 12
SKU2, 20, 2013-01-15, 20
SKU2, 20, 2013-01-16, 20
SKU2, 20, 2013-01-20, 20
SKU2, 20, 2013-11-20, 21
SKU2, 21, 2013-11-21, 21
];
*/
Thanks for any help.
Resolvi utilizando o IntervalMatch extendido.
Da uma olhada
Obrigado Yuri,
Exatamente o que precisava.