Today, we found a bug in the project, that is, about field sorting.
I wanted to get the result as follows:
However, the result is as follows: Put the A1 fan to the last one:
It is determined that it is not a plug-in problem, it must be an SQL problem. Because the original project is SQLServer, and then migrated to Oracle, this problem occurs.
The SQL statement of the original SQLServer is as follows, and there is no problem:
But in Oracle, it is like this:
In Oracle, you can delete the desc after tc. dataValue to achieve the expected results.
[Sqlserver]: sqlserver considers null to be the smallest. Sort in ascending order: null values are ranked first by default. To sort the values behind, order by case when col is null then 1 else 0 end and col sort in descending order: null values are ranked last by default. Order by case when col is null then 0 else 1 end, col desc [oracle]: oracle considers null to be the largest. Sort in ascending order. By default, the null value is placed behind. Sort in descending order. By default, the null value is ranked first. There are several ways to change this situation: (1) convert null to a specific value using the nvl function or decode function (2) convert null to a specific value using the case syntax (supported by later versions of oracle9i. Similar to sqlserver): order by (case mycol when null then 'Beijing drioker' else mycol end) www.2cto.com (3) Use nulls first or nulls last syntax. This is oracle's syntax for sorting null values. Nulls first: Place null at the top. For example, select * from mytb order by mycol nulls firstnull last: puts null at the end. For example, select * from mytb order by mycol nulls last