Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 0.23 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PostgreSQL ORDER BY issue - natural sort
  2. em_code  name
  3. EM001    AAA
  4. EM999    BBB
  5. EM1000   CCC
  6.        
  7. SELECT * FROM employees ORDER BY substring(em_code, 3)::int DESC
  8.        
  9. SELECT regexp_replace(em_code, E'\D','','g')
  10. FROM employees