I am trying to make a blog that displays all the comments, and the user will be able to send comments on the responses to previously posted no comments, then order in the sql request so that they appear in order, so that I continue to get the error.
SELECT c.userid, c.comment, c.reply, u.username, c.createdat, c.image, c.username as ComUser FROM Bundle:Comments c LEFT JOIN Bundle:Users u WITH c.userid = u.id WHERE c.articleid = 1 ORDER BY (CASE WHEN (c.parentid = 0) THEN c.id ELSE c.parentid END) c.createdat ASC
Gives an error: [Syntax error] line 0, col 515: Error: expected end of line received by "CASE"
even tried the normal way
ORDER BY IF(c.parentid = 0, c.id, c.parentid), c.createdat ASC
Gives an error: [Syntax error] line 0, col 515: Error: expected end of line, got '('
When I use regular ORDERY BY IF () in normal sql code (not doctrine), it works fine.
source share