P粉8086974712023-08-23 13:48:18
升序是大多数(如果不是全部)DBMS的默认排序方式,所以你的语句在这方面有点奇怪,但是无论如何,你可以通过在每个列上添加ASC或DESC来指定排序方式。
你的语句将变为:
SELECT title , project_index FROM projectdetail WHERE project_index BETWEEN 1 AND 6 ORDER BY title ASC , project_index ASC
编辑
正如@Arvo和@Dems所提到的,你当前是首先按照标题排序,如果标题相同,则按照project_index排序。如果你想要project_index首先排序,你必须将它放在ORDER BY子句的第一位。
你的语句将变为:
SELECT title , project_index FROM projectdetail WHERE project_index BETWEEN 1 AND 6 ORDER BY project_index ASC , title ASC
因为ASC是默认的排序顺序,所以你可以省略它们:
SELECT title , project_index FROM projectdetail WHERE project_index BETWEEN 1 AND 6 ORDER BY project_index , title