UPDATE Geo_postaggregated_pop_count_Ward SET Sum_male_count = (SELECT SUM(G.Person_count) FROM Geo_postaggregated_pop_count_Ward G WHERE Sex = 1); UPDATE Geo_postaggregated_pop_count_Ward SET Sum_female_count = (SELECT SUM(G.Person_count) FROM Geo_postaggregated_pop_count_Ward G WHERE Sex = 2); UPDATE Geo_postaggregated_pop_count_Ward SET Sum_of_person_count = (SELECT SUM(G.Person_count) FROM Geo_postaggregated_pop_count_Ward G WHERE Sex = 1 OR Sex = 2);