Re: Query Summary Help...
- Date: Thu, 22 Oct 2015 23:31:35 +0000
- From: Michael Dykman <mdykman@xxxxxxxxx>
- Subject: Re: Query Summary Help...
One more guess:
Try explicitly aliasing the fields of interest and using those aliases
exclusively throughout the rest of the expression.
p.pk_ProductID as pid,
p.Description as dsc,
SUM(i.Quantity) as totl
FROM invoice_invoicelines_Product p
JOIN invoice_InvoiceLines i ON pid = i.fk_ProductID
WHERE pid IN (1,2,3)
AND i.fk_InvoiceID IN (1,2,3)
GROUP BY pid;
Note that I moved the invoiceID clause out of the join condition into the
where filter. The ON clause should only contain expressions of relational
On Thu, Oct 22, 2015, 6:00 PM Don Wieland <donw@xxxxxxxxxxxxx> wrote:
> > On Oct 22, 2015, at 2:41 PM, Michael Dykman <mdykman@xxxxxxxxx> wrote:
> > I'm not at a terminal but have you tried grouping by p.pk_ProductID
> > of i.fk...? It is the actual value you are selecting as well as being on
> > the primary table in the query.
> Yeah I tried that - actually the SUM I need is on the JOIN relationship -
> results should be:
> Don Wieland