Open jlefebvre1997 opened 3 weeks ago
What I don't understand is that the generated SQL queries are absolutely identical (apart from the defaultSortBy
that gets added at the end but even if I remove it it still fails)
I fixed it by using addSelect
instead of orderBy
and ordering by the column I created :
`CASE
WHEN content.type = :folder THEN 1
WHEN content.type = :course THEN 2
WHEN content.type = :event THEN 3
ELSE 3
END`,
'type_order',
)
.addOrderBy('type_order', 'ASC')
Seems strange that this work but orderingb by with Case directly doesn't
Hello there :wave:
I'm using nestjs-paginate for my project, and as far as it goes everything is perfect, except this one thing : I'm trying to sort my data by a specific column, but I want a specific value to always be placed first, for example :
However, this fails with this error :
WHEN content" alias was not found. Maybe you forgot to join it?
, even though I did provide thecontent
alias when callingcreateQueryBuilder
. Any idea on why this happens ?Thanks for your time and help :pray: