Re: summing of my distance query

2006-06-24 Thread Dan Buettner
H - try adding a "group by b.zipcode" to the end ... Dan Scott Haneda wrote: Scott, I think you want something like this, then, assuming you still want to limit by radius from a given ZIP. SELECT b.zipcode, sum( b.inc_level1 ), sum( b.inc_level2 ), FROM zipcodes a, zipcodes b WHE

Re: summing of my distance query

2006-06-24 Thread Scott Haneda
> Scott, I think you want something like this, then, assuming you still > want to limit by radius from a given ZIP. > > SELECT b.zipcode, > sum( b.inc_level1 ), sum( b.inc_level2 ), > FROM zipcodes a, zipcodes b > WHERE a.zipcode = "94949" > AND (3956 * (2 * > ASIN(SQRT(POWER(SIN(((

Re: summing of my distance query

2006-06-23 Thread Dan Buettner
Scott, I think you want something like this, then, assuming you still want to limit by radius from a given ZIP. SELECT b.zipcode, sum( b.inc_level1 ), sum( b.inc_level2 ), FROM zipcodes a, zipcodes b WHERE a.zipcode = "94949" AND (3956 * (2 * ASIN(SQRT(POWER(SIN(((a.latitude-b.latit

Re: summing of my distance query

2006-06-23 Thread Scott Haneda
> Scott, can you expound on what 1 row would be returned, ideally? The > one with the shortest distance? Or a row with the sums of inc_level1 > ... inc_level7 ? > > Looks to me like you're trying to locate all the ZIP codes within a > given radius of (in this case) ZIP 94949 with the query below

Re: summing of my distance query

2006-06-23 Thread Dan Buettner
Scott, can you expound on what 1 row would be returned, ideally? The one with the shortest distance? Or a row with the sums of inc_level1 ... inc_level7 ? Looks to me like you're trying to locate all the ZIP codes within a given radius of (in this case) ZIP 94949 with the query below. Yes/n