Can I specify the direction for all columns in order?
i.e.
select * from my_table order by name desc, type desc
can you write the same thing using "desc" once?
Maybe something similar to this? (this does not work)
select * from my_table order by (name, type) desc
Not. The SQL standard does not allow this.
Having said that, there may be some RDBMSs that support this syntax. I just donβt know anything.
You can use row_number to do this:
row_number
select * from my_table order by row_number() over (order by name, type) DESC
In the last DESC, the row_number order will be inverted. Thus, it will flip ASC to DESC for name and type.
Source: https://habr.com/ru/post/890430/More articles:What could be the signature of this method? - disassemblyCalling a method by reflection with generics and overrides - genericsJava polymorphism and downgrade - javaUnknown server tag 'rsweb: ReportViewer' - c #Java recreates a string from hashcode - javaWhere to initialize something else in a UIViewController - iosDoes transaction block block performance in SQL Server? - performanceWhat dependencies are needed for the integrated ActiveMQ broker? - javaAndroid - How to show images from resources? - androidBuilding a CDF dataset in R? - rAll Articles