Hello,
I am writing a Query that I almost have complete but am having a problem with.
When I run the below query everything runs fine and I get the results that I am looking for.
but when I add ,
Sum(tblarInvoiceLine.Quantity) As 'Total Quan Used'
to the query I get duplicate lines rather than a total.
I am out of ideas on how to do this.
Thanks,
dwg23
Select Distinct
Max(tblwhPickTicket.DatePrinted) As 'Last Date',
tblimItemLocBin.Item,
tblimItemLocBin.Location,
tblimItemLocBin.Bin,
tblimItemLoc.ForecastDemandQty As 'FMD',
tblimItemLoc.Class As 'Item Class',
tblimItemLoc.QuantityOnHand As 'On Hand',
Count(tblarInvoice.InvoiceNumber) As 'Total Lines'
From
tblarInvoiceLine Inner Join
tblimItemLocBin On tblarInvoiceLine.Item = tblimItemLocBin.Item Inner Join
tblimItemLoc On tblimItemLocBin.Item = tblimItemLoc.Item And
tblimItemLocBin.Location = tblimItemLoc.Location Inner Join
tblarInvoice On tblarInvoice.InvoiceNumber = tblarInvoiceLine.InvoiceNumber
Inner Join
tblwhPickTicket On tblwhPickTicket.SONumber = tblarInvoice.SONumber Inner Join
tblimItemAttribute On tblimItemLocBin.Item = tblimItemAttribute.Item
Where
tblimItemLocBin.Location = 'sea' And
tblimItemAttribute.Attribute = 'SSP' And
tblimItemLocBin.Bin <> 'stock'
Group By
tblimItemLocBin.Item, tblimItemLocBin.Location, tblimItemLocBin.Bin,
tblimItemLoc.ForecastDemandQty, tblimItemLoc.Class,
tblimItemLoc.QuantityOnHand, tblarInvoice.InvoiceNumber,
tblarInvoiceLine.Quantity
I am writing a Query that I almost have complete but am having a problem with.
When I run the below query everything runs fine and I get the results that I am looking for.
but when I add ,
Sum(tblarInvoiceLine.Quantity) As 'Total Quan Used'
to the query I get duplicate lines rather than a total.
I am out of ideas on how to do this.
Thanks,
dwg23
Select Distinct
Max(tblwhPickTicket.DatePrinted) As 'Last Date',
tblimItemLocBin.Item,
tblimItemLocBin.Location,
tblimItemLocBin.Bin,
tblimItemLoc.ForecastDemandQty As 'FMD',
tblimItemLoc.Class As 'Item Class',
tblimItemLoc.QuantityOnHand As 'On Hand',
Count(tblarInvoice.InvoiceNumber) As 'Total Lines'
From
tblarInvoiceLine Inner Join
tblimItemLocBin On tblarInvoiceLine.Item = tblimItemLocBin.Item Inner Join
tblimItemLoc On tblimItemLocBin.Item = tblimItemLoc.Item And
tblimItemLocBin.Location = tblimItemLoc.Location Inner Join
tblarInvoice On tblarInvoice.InvoiceNumber = tblarInvoiceLine.InvoiceNumber
Inner Join
tblwhPickTicket On tblwhPickTicket.SONumber = tblarInvoice.SONumber Inner Join
tblimItemAttribute On tblimItemLocBin.Item = tblimItemAttribute.Item
Where
tblimItemLocBin.Location = 'sea' And
tblimItemAttribute.Attribute = 'SSP' And
tblimItemLocBin.Bin <> 'stock'
Group By
tblimItemLocBin.Item, tblimItemLocBin.Location, tblimItemLocBin.Bin,
tblimItemLoc.ForecastDemandQty, tblimItemLoc.Class,
tblimItemLoc.QuantityOnHand, tblarInvoice.InvoiceNumber,
tblarInvoiceLine.Quantity