Alright, I’ve moved on once again after reading your “wizard” document. I get it now about the TranType’s and have fixed that issue. But I am now receiving another error:
Severity: Error, Table: , Field: , RowID: , Text: The multi-part identifier “PartTran.SysDate” could not be bound.
The multi-part identifier “PartTran.SysDate” could not be bound.
I’m including the code I have thus far:
select
[PartQty].[PartNum] as [PartQty_PartNum],
[PartQty].[OnHandQty] as [PartQty_OnHandQty],
[SubQuery1].[Calculated_LastProdDate] as [Calculated_LastProdDate],
[SubQuery3].[Calculated_LastDateCust] as [Calculated_LastDateCust],
[SubQuery4].[Calculated_LastStk2Mtl] as [Calculated_LastStk2Mtl]
from Erp.PartQty as PartQty
inner join (select
[PartTran].[PartNum] as [PartTran_PartNum],
[PartTran].[TranType] as [PartTran_TranType],
(max( PartTran.SysDate )) as [Calculated_LastProdDate]
from Erp.PartTran as PartTran
where (PartTran.TranType = ‘STK-CUS’)
group by [PartTran].[PartNum],
[PartTran].[TranType]) as SubQuery1 on
SubQuery1.PartTran_PartNum = PartQty.PartNum
inner join (select
[PartTran1].[PartNum] as [PartTran1_PartNum],
[PartTran1].[TranType] as [PartTran1_TranType],
(max( PartTran.SysDate )) as [Calculated_LastDateCust]
from Erp.PartTran as PartTran1
where (PartTran1.TranType = 'MFG-STK')
group by [PartTran1].[PartNum],
[PartTran1].[TranType]) as SubQuery3 on
SubQuery3.PartTran1_PartNum = PartQty.PartNum
inner join (select
[PartTran2].[PartNum] as [PartTran2_PartNum],
[PartTran2].[TranType] as [PartTran2_TranType],
(max( PartTran.SysDate )) as [Calculated_LastStk2Mtl]
from Erp.PartTran as PartTran2
where (PartTran2.TranType = 'STK-MTL')
group by [PartTran2].[PartNum],
[PartTran2].[TranType]) as SubQuery4 on
SubQuery4.PartTran2_PartNum = PartQty.PartNum
inner join Erp.PartCost as PartCost on
PartCost.Company = PartQty.Company
And
PartCost.PartNum = PartQty.PartNum