Timeline for Postgres SUM over PARTITION BY "tolerate" null values
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 22, 2021 at 16:42 | history | edited | Erwin Brandstetter | CC BY-SA 4.0 |
tag, minor edits
|
Apr 22, 2021 at 16:36 | vote | accept | vmachacek | ||
Apr 22, 2021 at 6:33 | answer | added | Erwin Brandstetter | timeline score: 3 | |
Apr 22, 2021 at 0:14 | comment | added | Charlieface |
Which grouping would you want it to be part of e.g values in SupplierFacilityId are null, 1, 1, 2, 3 which of those values do you want to add its sum to? Or do you want a separate group for the null? From the screenshot you link above, it's unclear why SupplierFacilityId is being grouped at all
|
|
Apr 21, 2021 at 13:48 | comment | added | ypercubeᵀᴹ |
So you want to have rows where SupplierFacilityId is null not as a separate partition but assign them to (possibly more than one) different partitions according to some rule. You'll have to specify what this rule would be.
|
|
Apr 21, 2021 at 12:36 | comment | added | ypercubeᵀᴹ | Please edit and add this in the question, preferably as text, not image | |
Apr 21, 2021 at 11:52 | comment | added | vmachacek | imgur.com/KtU2DrX this is showing what I have in mind. Running sum should be 445 on the last row. | |
Apr 21, 2021 at 11:35 | answer | added | J.D. | timeline score: 1 | |
Apr 21, 2021 at 10:55 | comment | added | ypercubeᵀᴹ |
You can have a partition where s.LocationId is 1 , s.PartId is 2 and s.SupplierFacilityId is NULL . So where is the problem?
|
|
Apr 21, 2021 at 10:53 | comment | added | Laurenz Albe | How would NULL contribute to the sum? | |
Apr 21, 2021 at 10:53 | comment | added | ypercubeᵀᴹ | Did you try it? What was the issue? | |
Apr 21, 2021 at 10:51 | history | asked | vmachacek | CC BY-SA 4.0 |