Yep...
That was ONE of the problems. The other was that I needed an "AND v_pop
before the final value. Here's the working result:
CASE
WHEN v_pop <= 50 THEN 'white'
WHEN v_pop >= 50 AND v_pop <= 99 THEN 'pink'
WHEN v_pop >= 100 AND v_pop <= 199 THEN 'salmon'
WHEN v_pop >= 200 AND v_pop <= 299 THEN 'yellow'
WHEN v_pop >= 300 AND v_pop <= 399 THEN 'orange'
WHEN v_pop >= 400 AND v_pop <= 499 THEN 'red'
WHEN v_pop >= 500 AND v_pop <= 599 THEN 'brick'
WHEN v_pop >= 600 THEN 'purple'
ELSE 'black'
END AS class
<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: Josh Nathanson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 01, 2006 1:11 PM
To: CF-Talk
Subject: Re: mySQLxCase statement: where value in range
In the orange, red, and brick cases, you have >300 <299, >400 <399, and
>500<499, which leaves no possibility for values. You need to bump up each
of those less than values by 100. I'm sure it was just a typo on your part.
-- Josh
----- Original Message -----
From: "Andy Matthews" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Thursday, June 01, 2006 11:05 AM
Subject: mySQLxCase statement: where value in range
> I've got a table with around 40000 records. There's a column called v_pop
> with a range of 2 - 1000. I'd like to color code some HTML but use the
> query
> to do that work. So check out the code below. It runs just fine, with no
> errors, BUT, it only returns white and pink as the class, even though I
> know
> for a fact that there are records with higher values. What am I doing
> wrong
> here?
>
> I'm running mySQL 4.1.17
>
> SELECT v_player,
> CASE
> WHEN v_pop < 49 THEN 'white'
> WHEN v_pop > 50 < 99 THEN 'pink'
> WHEN v_pop > 100 < 199 THEN 'salmon'
> WHEN v_pop > 200 < 299 THEN 'yellow'
> WHEN v_pop > 300 < 299 THEN 'orange'
> WHEN v_pop > 400 < 399 THEN 'red'
> WHEN v_pop > 500 < 499 THEN 'brick'
> END AS class
> FROM x_world
>
> <!----------------//------
> andy matthews
> web developer
> certified advanced coldfusion programmer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --------------//--------->
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241942
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54