I’m trying to run the below query in the postgresql
SELECT module
FROM(
VALUES ('Data Archiving/Back-Up/Recovery'), ('Database Management Software'), ('Data Warehousing/Mining')
) s(module) ORDER BY module ASC;
I’m expecting the order should look like below
module |
---|
Data Archiving/Back-Up/Recovery |
Data Warehousing/Mining |
Database Management Software |
But it shows in below order
module |
---|
Data Archiving/Back-Up/Recovery |
Database Management Software |
Data Warehousing/Mining |
Can someone help me understand this behavior?
2
Answers
There is a work around to achieve it by sorting your data by module with spaces replaced by the character
'a'
.As mentioned in comment you should realy check the PostgreSQL COLLATE support (a search with "postgresql weird order" quickly directs you toward)
Example