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 )
- ERROR 1054(42S22) Unknown column ‘password’ in ‘field list’ (Fixed)
- Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)
- After installing mysql5.7 on centos7, an error 1045 (28000) is reported: access denied for user ‘root’ @’localhost ‘(using PAS)
- SQL server converts multiple lines into one line, separated by characters
- How to Check the most CPU consuming 50 queries in MYSQL
- Error 1406 (22001) in MySQL: data too long for column (Fixed)
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- Error creating foreign key in MySQL: 1215 cannot add the foreign key constraint
- SQL statement to calculate the distance between two coordinates
- How To Change ASM SYS PASSWORD
- How to Fix MySQL error 1005: can’t create table (errno: 150)
- mysqli_ Error() has no return value (Fixed)
- MySQL 8.0 error 1114 (HY000): the table’sbtest1’is full (Fixed)
- [305]MYSQL 1062 error: duplicate entry ‘…’ for key ‘primary
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used by doubl
- MySQL automatically creates partitions through events
- [How to Fix] Database can’t open file (errno:24)