An additional field is pretty much impossible since that case would change throughout the day unfortunately. But thank you all for your assistance, will do some testing.
Jeff
-----Original Message-----
From: Jaime Crespo Rincón [mailto:jcrespo@stripped]
Sent: Monday, October 26, 2009 12:52 PM
To: Jeff
Cc: mysql@stripped
Subject: Re: Using IF in a query to set a variable then sort on said variable
2009/10/26 Jeff <Jeff@platinumsynergy.com>:
> Perhaps case is the way to go, I'll look into that this morning.
>
> Unfortunately there are three groupings. So my IF or CASE needs to check for example:
>
> if timezone = 3,5,6,7 then 1
> if timezone = 1,2,4 then 2
> if timezone = 8,9 then 3
Yes, Case function is the way to go.
Anyway, check for performance issues: in that case, precalculating and
storing an aditional field would be the best way (it could be done
with a trigger, for example).
--
Jaime Crespo
MySQL & Java Instructor
Warp Networks
<http://warp.es>