Win has asked for the wisdom of the Perl Monks concerning the following question:
Take each of these values and then where Aggregated_area = each distinct value do the following:SELECT DISTINCT Aggregated_area FROM Geo_postaggregated_pop_count_Ward;
Do I really need to use the Perl foreach command to do this?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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SQL or Perl solution
by Abigail-II (Bishop) on Mar 08, 2004 at 15:45 UTC | |
| |
|
Re: SQL or Perl solution
by UnderMine (Friar) on Mar 08, 2004 at 15:47 UTC | |
| |
|
Re: SQL or Perl solution
by Plankton (Vicar) on Mar 08, 2004 at 16:29 UTC |