Query failed: ERROR: syntax error at or near "ORDER" LINE 1: ...try ON entry.user_id = users.id WHERE users.id = ORDER BY e... ^