Or try this one, that I once saw here on the list and use widely with
labelling and tematic layers:

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

I have simply added a Int() function to all your sub-expressions.

HTH,

Peter
------------------------------------------------------------------------------------------------
Peter Horsbøll Møller, GIS Udviklingskonsulent / GIS-Developer
Kampsax A/S - GIS Software & Solutions
Rugaardsvej 55, 5000 Odense, DK
tel: +45 6313 5013,  dir:+45 6313 5008,  fax: +45 6313 5090
mailto:[EMAIL PROTECTED]
www.kampsax-gis.dk and www.kampsax.dk
Authorized MapInfo Partner & Distributor in Denmark and Norway.
------------------------------------------------------------------------------------------------
Klik ind på http://www.kortal.dk og se det hele lidt fra oven!
----- Videresendt af Peter Møller/Kampsax - 09-04-2002 08:56 -----
                                                                                       
                                
                    "DPC"                                                              
                                
                    <darrinclement@ne        Til:    "K Miller" 
<[EMAIL PROTECTED]>,                              
                    tzero.net>               <[EMAIL PROTECTED]>       
                                
                                             cc:                                       
                                
                    09-04-2002 03:16         Vedr.:  RE: MI-L SQL query to group data 
on classifications               
                                                                                       
                                
                                                                                       
                                



Seems like you have 90% of it figured out.  I'll assume your
table is called MyTable and the field where you are storing
your group sums is MyField [as a Char(4)].  If you take your
last expression (where you get "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, then all you have to do is:

select * from MyTable where MyField = "TFFF"
update selection set MyField = 1
select * from MyTable where MyField = "TTFF"
update selection set MyField = 2
select * from MyTable where MyField = "TTTF"
update selection set MyField = 3
select * from MyTable where MyField = "TTTT"
update selection set MyField = 4

At least, this works for me.  Good luck!

DPC
-----Original Message-----
From: K Miller [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 4:50 PM
To: [EMAIL PROTECTED]
Subject: MI-L SQL query to group data on classifications


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>=100
00)*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]




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





---------------------------------------------------------------------
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