PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Don't like ads?
PRO users
don't see any ads ;-)
Public Pastes
Untitled
3 sec ago
Untitled
9 sec ago
Futurama S07E15 HDTV XviD AFG
10 sec ago
Untitled
10 sec ago
ser_1371709015500
12 sec ago
Untitled
50 sec ago
StarMade Stacktrace
18 sec ago
playerID receiver
21 sec ago
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)
PostgreSQL ORDER BY issue - natural sort
em_code name
EM001 AAA
EM999 BBB
EM1000 CCC
SELECT * FROM employees ORDER BY substring(em_code, 3)::int DESC
SELECT regexp_replace(em_code, E'\D','','g')
FROM employees
create a
new version
of this paste
RAW Paste Data
PostgreSQL ORDER BY issue - natural sort em_code name EM001 AAA EM999 BBB EM1000 CCC SELECT * FROM employees ORDER BY substring(em_code, 3)::int DESC SELECT regexp_replace(em_code, E'\D','','g') FROM employees