> On 13 Aug 2019, at 15:19, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
> On Tuesday, August 13, 2019, Alban Hertroys <haramrae@gmail.com> wrote:
>
> > On 13 Aug 2019, at 13:10, stan <stanb@panix.com> wrote:
> >
> > select
> > project.proj_no ,
>
> Removed columns that get in the way of your desired result. You can’t have both details and the sum over them in a
meaningfulway.
>
> Sure you can, at least generally, with Window Functions/Expressions (i.e., OVER)
That’s why I added “in a meaningful way” ;)
Repeating the same SUM-result on every line in a group is not what I’d call a meaningful result; the SUM has no bearing
onthe detailed line and leads to the kind of mistakes I already mentioned.
(For the record; I do this kind of grouping in a hierarchical database regularly, but there the grouped SUM is at a
differentlevel in the hierarchy and I consider it thus sufficiently separated from the detail rows.)
Besides, I figured the OP was already struggling with the query syntax, adding window functions into the mix didn’t
seema good idea in the context. Possible?, sure, desirable?, I would say not.
Alban Hertroys
--
There is always an exception to always.