I currently have a query like so:

SELECT p.fldId, p.fldFName, p.fldLName, p.fldEmail, p.fldPhone, p.resellerId, 
d.timezoneId, d.bestTime, d.lastDate, d.lastTime, d.lastConnected FROM 
tblProspects as p LEFT JOIN tblProspectsDetails as d ON d.prospectId = p.fldId 
WHERE p.uId = "46437" ORDER BY d.lastDate ASC, d.timezoneId DESC

Basically I have been trying several ways to get this set up to work but due to 
the way the timezones are set up in this system, a regular sort won't work.

What I want to know is, is it possible to check the value of  field and set a 
variable, then sort on that. For example:

IF d.timezone = 5 THEN @tempzone = 1

Then sort the entire query on that tempzone. Basically what I want to do is 
test the timezone ids versus a few numbers, assign them a value and sort on 
that.

IF d.timezone = (1,3,5,8) THEN @tempzone = 1 (pseudo code)

Is this possible in a mySQL query directly? The only other option I guess I 
have is to run a mass update on a field then doing the normal order but doing 
three updates just to make one select work seems kind of unfortunate :(

Jeff

Reply via email to