0

I'm getting an error where it says

Error: near line 3: near "DESC": syntax error

My code is

SELECT title, rating FROM movies JOIN ratings ON movies.id = ratings.movie_id WHERE year = 2010
ORDER BY 
(CASE
    WHEN rating = rating THEN title
    ELSE rating DESC
END);

Is this a problem with the CASE that I'm using or is this an error with the syntax I'm using

0

ORDER BY can take multiple criteria so all I needed was ORDER BY rating DESC, title and not the CASE.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .