`sql.join` with `ODER BY` leads to syntax error while the sql query seems correct.
I am conditionally sorting the results from a database query
The query builder returns the following query
Which seems to be correct. When executing the code I get the following
PostgresError
:
Something seems to be off with 'desc'
but I don't have a clue what is causing this.
Any help is appreciated2 Replies
I don't think you can put the order in the query parameters
Try this:
this results in
with the following error:
syntax error at or near \"nulls\"
🤔
sql.join
seems to be the cause for the problem here:
if I use
this results in a query of
and a successful db query
The problem was not using sql.raw
on the join
separator:
this is the correct code to achieve what I want to do: