Subject | Re: R: R: [firebird-support] 1 a n relationship with GROUP BY conditioned on master |
---|---|
Author | Mark Rotteveel |
Post date | 2011-12-08T10:25:22Z |
On Wed, 7 Dec 2011 17:34:41 +0100, "P-Soft - Codebue Fabio"
<f.codebue@...> wrote:
probably several invoices that share the same cms_code. If you want totals
per invoice, you also need to group on the primary key of the invoice.
It is much easier to work with an actual table structure and same example
values, because then you can infer what you actually need :)
Mark
<f.codebue@...> wrote:
> Mark,My query is not grouping on invoice, so it is expected as there are
> it doesnt work. I try to be more specific
>
> A is invoice header
> B is invoice rows
>
> SO I need to
> - aggregate rows on the same B.cms_code (something like pn type)
> - summing B.pn_value
> - filering on A.invoice_Date
>
> With your code something strange happens.... I have value more greater
> than invoice total.
probably several invoices that share the same cms_code. If you want totals
per invoice, you also need to group on the primary key of the invoice.
It is much easier to work with an actual table structure and same example
values, because then you can infer what you actually need :)
Mark