Re: Conditional ODER BY Clause HELP

"Hal.sz S.ndor" <[email protected]>
Newsgroups gmane.comp.db.mysql.general
Organization the less, the better
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.