Re: Conditional ODER BY Clause HELP

2016-03-21 Thread Hal.sz S.ndor

2016/03/18 12:54 ... Don Wieland:

Trying to get the correct syntax on this:

ORDER BY
CASE
WHEN tr.Placed = "X" THEN r.Division ASC, 
FIELD(tr.Place,"1","2","3","4","5","6","7","8","R","WD","Exc","E","S”), tr.Score DESC
WHEN tr.Placed != "X" THEN tr.ride_time ASC
END


How does one deal with CONDITION study like this?

That certainly is quite wrong. It is
ORDER BY f1 [ASC/DESC], f2 [ASC/DESC], ...
where each "f" may be a formula. This is valid:

ORDER BY
CASE
WHEN tr.Placed = "X" THEN r.Division
ELSE tr.ride_time
END ASC, 
FIELD(tr.Place,"1","2","3","4","5","6","7","8","R","WD","Exc","E","S”), 
tr.Score DESC


but maybe you don't want that.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Conditional ODER BY Clause HELP

2016-03-19 Thread Don Wieland
Hi gang,

Trying to get the correct syntax on this:

ORDER BY 
CASE 
WHEN tr.Placed = "X" THEN r.Division ASC, 
FIELD(tr.Place,"1","2","3","4","5","6","7","8","R","WD","Exc","E","S”), 
tr.Score DESC 
WHEN tr.Placed != "X" THEN tr.ride_time ASC 
END


How does one deal with CONDITION study like this?

Thanks in advance for any assistance

Don

Conditional ODER BY Clause HELP

2016-03-19 Thread Don Wieland
Hi gang,

Trying to get the correct syntax on this:

ORDER BY 
CASE 
WHEN tr.Placed = "X" THEN r.Division ASC, 
FIELD(tr.Place,"1","2","3","4","5","6","7","8","R","WD","Exc","E","S”), 
tr.Score DESC 
WHEN tr.Placed != "X" THEN tr.ride_time ASC 
END


How does one deal with CONDITION study like this?

Thanks in advance for any assistance

Don