Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

136
Views
PostgreSQL ordena por, los números duran

name2 podría ser una cadena o un número. Es decir 'one two' o 12

Me gustaría ordenar los nombres para que los números sean los últimos, es decir:

 aa bb one two 1 22
 select name1, name2 from names order by name2

P: ¿cómo se haría?

PS en Oracle es así .

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede usar la función REGEXP_REPLACE() con '[^[:digit:]]*' posix, para determinar si la cadena tiene un dígito o no, incluido un asterisco al final para anclar una expresión regular al final del texto de origen :

 SELECT name2 FROM t ORDER BY REGEXP_REPLACE(name2,'[^[:digit:]]*',''), name2

Manifestación

over 4 years ago · Santiago Trujillo Report

0

Puede usar una expresión booleana en order by , por ejemplo:

 select name1, name2 from names order by left(name2, 1) <= '9', name2

Db<>violín.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!