List:General Discussion« Previous MessageNext Message »
From:Jeff Date:October 26 2009 5:16pm
Subject:RE: Using IF in a query to set a variable then sort on said variable
View as plain text  
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>
Thread
Using IF in a query to set a variable then sort on said variableJeff23 Oct
  • Re: Using IF in a query to set a variable then sort on said variableJaime Crespo Rincón25 Oct
RE: Using IF in a query to set a variable then sort on said variableJeff26 Oct
  • Re: Using IF in a query to set a variable then sort on said variableJaime Crespo Rincón26 Oct
    • RE: Using IF in a query to set a variable then sort on said variableJeff26 Oct