BAQ Results duplicating

Hello All,

I just want the BAQ to show company, destination due date PO number part the line the release and the qty however as you can see in the example its multiplied it all please let me know where im going wrong

/*

  • Disclaimer!!!
  • This is not a real query being executed, but a simplified version for general vision.
  • Executing it with any other tool may produce a different result.
    */select
    [ContainerHeader].[Company] as [ContainerHeader_Company],
    [ContainerHeader].[Destination_c] as [ContainerHeader_Destination_c],
    [POHeader].[DueDate] as [POHeader_DueDate],
    [PODetail].[PONUM] as [PODetail_PONUM],
    [PODetail].[PartNum] as [PODetail_PartNum],
    [PODetail].[POLine] as [PODetail_POLine],
    [PODetail].[OrderQty] as [PODetail_OrderQty],
    [PORel].[PORelNum] as [PORel_PORelNum]
    from Erp.ContainerHeader as ContainerHeader
    inner join Erp.ContainerDetail as ContainerDetail on
    ContainerHeader.Company = ContainerDetail.Company
    and ContainerHeader.ContainerID = ContainerDetail.ContainerID
    inner join Erp.POHeader as POHeader on
    ContainerDetail.Company = POHeader.Company
    and ContainerDetail.PONum = POHeader.PONum
    inner join Erp.PODetail as PODetail on
    POHeader.Company = PODetail.Company
    and POHeader.PONum = PODetail.PONUM
    and ( PODetail.OpenLine = TRUE )

inner join Erp.PORel as PORel on
PODetail.Company = PORel.Company
and PODetail.PONUM = PORel.PONum
and PODetail.POLine = PORel.POLine

Hi Connor,

We don’t use containers but I’ll try to help with BAQ. It looks like it might be blowing up the data because you do not have a tie between the PO line and the Container detail. Is this right? If not, make that relation. If it’s true, then maybe try to use Select Distinct per below:

Nancy