How to use it when sorting individual fields
example.setOrderByClause("user_type ASC"); //Output sorted by user type in ascending order
Running SQL looks something like this
SELECT ...
FROM tab_sy_user
order by user_type ASC
The method of using when sorting multiple fields separated by a comma
The query results are sorted by the order in which the fields are sorted, and if the conditions are the same, continue the conditional sort by the next field until the last field sort is complete.
//First according to user_type ascending ASC sorting, if there is the same condition, in accordance with the level condition descending DESC sorting
example.setOrderByClause("user_type ASC, level DESC");
Running SQL looks something like this
SELECT ...
FROM tab_sy_user
order by user_type ASC, level DESC
Read More:
- SQL Server Group sort de duplication row_ number() over ( PARTITION BY t1.col_ 2 ORDER BY 1 )
- [How to Fix]Mybatisplus ignores mapped fields
- SQL server converts multiple lines into one line, separated by characters
- Mysql :error 1111. Invalid use of group function
- MYSQL: How to Use ifnull()
- [Solved] Anaconda Error: pyqt can’t use QSqlDatabase to connect to MySQL
- [Solved] mysqldump: Got error: 1556: “You can‘t use locks with log tables.“ when using LOCK TABLES
- MYSQL Use cmd to change root password error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual tha
- [Solved] Error response from daemon: Conflict. The container name “/mysql is already in use by container
- [Solved] SQL Error: Method queryTotal execution error of sql
- [Solved] PostgreSQL enumeration type usage error: operator does not exist error handling
- [MySQL] The principle of group by aggregation function and the reason for aggregation limitation SELECT list is not in GROUP BY clause and contains nonaggregated column
- MySQL OrderBy Error: Expression #1 of ORDER BY
- How to Solve MySQL version 5.7+ Group by group error
- [Solved] MySQL Error: ERROR 1055 (42000)sql_mode=only_full_group_by
- [Solved] Sequelize DatabaseError: ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP
- [Solved] ERROR 1054 (42S22): Unknown column ‘password‘ in ‘field list‘
- Mysql5.7.18.1 Error 1054 (42S22): Unknown Column’password’ In’field List’ When Changing User Password
- ERROR 1054(42S22) Unknown column ‘password’ in ‘field list’ (Fixed)
- [Solved] Daily further: database error: unknown column ‘model’ in ‘field list‘