Skip to content
Advertisement

Tag: sql-order-by

Custom sorting in oracle

I am trying to sort a particular column “TENOR” on the basis on maturity (group by Currencies) for eg – it should be sorted in the following order ON, SW, 1M, 2M, 3M, 6M, 9M, 1Y, 18M, 2Y and so on.. where ON = Overnight, SW = Single week and 1M = 1 month. i have tried using order by

How to sort numbers last in PostgreSQL?

Found many related answers, but nothing that did this. How to sort by numbers last: And, preferably (but not necessary) PostgreSQL 11.9 Also, probably don’t want to use a regex for performance reasons. Don’t want to create an index either… Answer I think a regex is the right way to do this: This puts first rows that contain no digit

Advertisement