im trying to build a BAQ so i can pull BoM Cost and compare to Selling price more easily.
i got the BAQ to pull the material but the Cost is pulling from the parent part. Where did i go wrong
select
[PartRev].[PartNum] as [PartRev_PartNum],
[Part].[PartDescription] as [Part_PartDescription],
[Part].[UnitPrice] as [Part_UnitPrice],
[PartMtl].[MtlPartNum] as [PartMtl_MtlPartNum],
[PartMtl].[QtyPer] as [PartMtl_QtyPer],
[PartCost].[AvgMaterialCost] as [PartCost_AvgMaterialCost]
from Erp.PartMtl as PartMtl
inner join Erp.PartRev as PartRev on
PartMtl.Company = PartRev.Company
and PartMtl.PartNum = PartRev.PartNum
and PartMtl.RevisionNum = PartRev.RevisionNum
and PartMtl.AltMethod = PartRev.AltMethod
and ( PartRev.PartNum like PartRev.PartNum )
inner join Erp.Part as Part on
PartRev.Company = Part.Company
and PartRev.PartNum = Part.PartNum
inner join Erp.PartCost as PartCost on
PartMtl.Company = PartCost.Company
and PartMtl.PartNum = PartCost.PartNum
where PartRev.PartNum like @BeginsWith