---
---Validacion de pedidos con sku duplicados
---
select a.*, b.*, c.strCodigoBarra from
(
select
a.strNumDoc, b.strCodLin, count(b.strcodlin) total
from tbl_pedcab a, tbl_peddet b
where
a.strTipDoc = b.strTipDoc and a.strNumDoc = b.strNumDoc and a.strTipDoc = 'pd' and a.logFacturado = 0
group by a.strNumDoc, b.strCodLin
) a
inner join
(
Select
c.numeropedido, a.sku, count(a.sku) total
from
[192.168.10.14].[MP_StockSupply].picking.PedidosSkuPickeados a,
[192.168.10.14].[MP_StockSupply].Picking.PedidosCuerpos b,
[192.168.10.14].[MP_StockSupply].Picking.PedidosEncabezados c
where
a.PedidoCuerpoId = b.PedidoCuerpoId and b.PedidoEncabezadoId = c.PedidoEncabezadoId
group by
c.numeropedido, a.sku
) b on a.strnumdoc = b.numeropedido and a.strcodlin = b.sku
inner join tblsku c on a.strCodLin = c.strCodLin
where
a.total <> b.total
and strNumDoc = '0019485176'
and strCodigoBarra = '7707216592390'