in reply to Conversion to SPROC
Obviously untested, but I think this should produce the right results.create proc calculating_pop_summations_A as SELECT Sum_count = sum(Person_count), Sex, Aggregated_area INTO #tmp FROM Geo_postaggregated_pop_count GROUP BY Sex, Aggregated_area update Geo_postaggregated_pop_count SET Sum_female_count = t.Sum_count FROM Geo_postaggregated_pop_count G , #tmp t WHERE G.Aggegated_area = t.Aggregated_area AND G.Sex = t.Sex AND G.Sex = 2 update Geo_postaggregated_pop_count SET Sum_male_count = t.Sum_count FROM Geo_postaggregated_pop_count G , #tmp t WHERE G.Aggegated_area = t.Aggregated_area AND G.Sex = t.Sex AND G.Sex = 1
Michael
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Conversion to SPROC
by Win (Novice) on Jun 17, 2004 at 13:14 UTC | |
by Win (Novice) on Jun 17, 2004 at 13:45 UTC | |
by Win (Novice) on Jun 17, 2004 at 13:24 UTC |