A secure aggregate sum system comprising a plurality of secure computation apparatuses (1 1,..., 1 N), m being an integer equal to or greater than 2, [v]: = [v 0],..., [v m-1] being a share obtained by secret sharing a desired value attribute v: = v 0,..., v m-1 when a table including a key attribute and a value attribute is sorted based on a value of the key attribute, [e]: = [e 0],..., [e m-1] being a share obtained by secret sharing a flag e: = e 0,..., em-1 wherein for each integer i equal to or greater than 0 and equal to or less than m-1 e i indicates a last element of each group with true and other elements with false when the table is grouped based on the value of the key attribute, { {σ}} being a share obtained by secret sharing a permutation σ which moves elements so that the last elements of each group are sequentially arranged from beginning when the table is grouped based on the value of the key attribute, and g being a maximum number of the groups, each of the secure computation apparatuses comprising: a prefix-sum part configured to generate a share [v'] which becomes a vector v': = v' 0,..., v' m-1, when reconstructed, by setting a sum from v 0 to v i at v' i for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v]; a flag applying part configured to generate a share [t] which becomes a vector t: = t 0,..., t m-1, when reconstructed, by setting [v' i] at [t i] if [e i] is true, and setting [v' m-1] at [t i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v'] and the share [e]; a sorting part configured to generate a share [σ(t)] which becomes a sorted vector σ(t) obtained by sorting the vector t with the permutation σ, when reconstructed, using the share [t] and the share { {σ}}; and a sum computing part configured to generate a share [s] which becomes a vector s: = s 0,..., s min(g, m) -1 representing a sum of a value attribute v for each group, when reconstructed, by setting [s i]: = [σ(t) i -σ(t) i-1] for each integer i equal to or greater than 1 and equal to or less than min(g, m)-1, and setting [s 0]: = [σ(t) 0] using the share [σ(t)]. m being an integer equal to or greater than 2, [v]: = [v 0],..., [v m-1] being a share obtained by secret sharing a desired value attribute v: = v 0,..., v m-1 when a table including a key attribute and a value attribute is sorted based on a value of the key attribute, [e]: = [e 0],..., [e m-1] being a share obtained by secret sharing a flag e: = e 0,..., em-1 wherein for each integer i equal to or greater than 0 and equal to or less than m-1 e i indicates a last element of each group with true and other elements with false when the table is grouped based on the value of the key attribute, { {σ}} being a share obtained by secret sharing a permutation σ which moves elements so that the last elements of each group are sequentially arranged from beginning when the table is grouped based on the value of the key attribute, and g being a maximum number of the groups, each of the secure computation apparatuses comprising: a prefix-sum part configured to generate a share [v'] which becomes a vector v': = v' 0,..., v' m-1, when reconstructed, by setting a sum from v 0 to v i at v' i for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v]; a flag applying part configured to generate a share [t] which becomes a vector t: = t 0,..., t m-1, when reconstructed, by setting [v' i] at [t i] if [e i] is true, and setting [v' m-1] at [t i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v'] and the share [e]; a sorting part configured to generate a share [σ(t)] which becomes a sorted vector σ(t) obtained by sorting the vector t with the permutation σ, when reconstructed, using the share [t] and the share { {σ}}; and a sum computing part configured to generate a share [s] which becomes a vector s: = s 0,..., s min(g, m) -1 representing a sum of a value attribute v for each group, when reconstructed, by setting [s i]: = [σ(t) i -σ(t) i-1] for each integer i equal to or greater than 1 and equal to or less than min(g, m)-1, and setting [s 0]: = [σ(t) 0] using the share [σ(t)]. a prefix-sum part configured to generate a share [v'] which becomes a vector v': = v' 0,..., v' m-1, when reconstructed, by setting a sum from v 0 to v i at v' i for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v]; a flag applying part configured to generate a share [t] which becomes a vector t: = t 0,..., t m-1, when reconstructed, by setting [v' i] at [t i] if [e i] is true, and setting [v' m-1] at [t i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v'] and the share [e]; a sorting part configured to generate a share [σ(t)] which becomes a sorted vector σ(t) obtained by sorting the vector t with the permutation σ, when reconstructed, using the share [t] and the share { {σ}}; and a sum computing part configured to generate a share [s] which becomes a vector s: = s 0,..., s min(g, m) -1 representing a sum of a value attribute v for each group, when reconstructed, by setting [s i]: = [σ(t) i -σ(t) i-1] for each integer i equal to or greater than 1 and equal to or less than min(g, m)-1, and setting [s 0]: = [σ(t) 0] using the share [σ(t)].