Greetings,

I am trying to write a SQL query to group my data (and provide group sums) 
on specific categories of a particular field. In particular, I'm trying to 
sum population by population density categories (< 1,000 people per square 
mile, 1,000 - 5,000 ppsm, 5,000 - 10,000 ppsm, > 10,000 ppsm). I thought I 
could use an expression in the "select columns" portion of the SQL query, 
but I am coming up against a brick wall. I tried using an expression such as

(popden>=0)*1+(popden>=1000)*1+(popden>=5000)*1+(popden>=10000)*1

in the hopes that it would give me "1" for up to 1,000, "2" for 1,000 to 
5,000, "3" for 5,000 to 10,000, and "4" for above 10,000, but MI complains 
about a datatype mismatch (it doesn't treat a logical as a number). Any 
suggestions? Ways to convert between a "True" and a 1? Other ways to go 
about this? I'd rather not create a new column in the table and set it's 
value. I'd like the solution to be more dynamic than that.

For now, my only hope is an expression in the following form:

str$(popden>=0) & str$(popden>=1000) & str$(popden>=5000) & 
str$(popden>=10000)

which gives me "TFFF" for up to 1,000, "TTFF" for 1,000 to 5,000, "TTTF" for 
5,000 to 10,000, and "TTTT" for above 10,000. Not my ideal solution, but at 
least it works.

Thanks in advance for your help, and I'll SUM any other solutions I might 
come across.



------------------------------------------------------------------------

Keith Miller
Principal Planner: GIS and Modeling
North Jersey Transportation Planning Authority, Inc.
One Newark Center, 17th floor
Newark, NJ 07102
973-639-8444
[EMAIL PROTECTED]




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to