projection/replication sql query?


my sql bit rusty -- there sql proceed digest an quarrel list looks something this:



name                slotvalue              slots
---- --------- -----
abc 3 1
abc 4 2
abc 6 5


into 'projected' outcome list looks this:



name                slotsum                 slot
---- ------- ----
abc 13 1
abc 10 2
abc 6 3
abc 6 4
abc 6 5


in words, outcome set should enclose array rows equal max(slots), enumerated (slot) 1 max(slots), sum any 'slots' should simulate sum slotvalues projected out 'slots' position. pathological case:



name               slotvalue                slots
---- --------- -----
abc 4 3


we should get:



name               slotsum                  slot
---- ------- ----
abc 4 1
abc 4 2
abc 4 3


the summation explanation graceful candid -- digest any slotvalue out array slots:



slotvalue         slotvalue        slotvalue       container             sum
--------- --------- --------- ---- ---
3 4 6 1 13 (3+4+6)
0 4 6 2 10 (0+4+6)
0 0 6 3 6 (0+0+6)
0 0 6 4 6 (0+0+6)
0 0 6 5 6 (0+0+6)


update: finish i used various localghost's proceed stored proc. i anticipating there competence proceed but loop.



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members