I need to sort the data from the database. For example, there is data: 1,2, A, 1C, 1A, B, 3,10, after applying the sorting I expect to see: 1,1A, 1C, 2,3,10, A, B.
Once I already had such a task, but without using the framework. I decided this with this query:
SELECT * FROM table ORDER BY Name=0,-Name DESC, Name The request is working and gives the desired result. How to write such a query using querybuilder? I manage to sort it like this: A, B, 1,1A, 1C, 2,3,10. With this request:
SELECT t FROM table t ORDER BY t.name+0 ASC, t.name But if you put an equal sign or a minus in the sorting condition, I get an error. Therefore I can not sort the data in any way.
Tell me, how can I solve this problem?