I have this table (each row represents one document with title and status):
Code:
id(int), title(varchar), status(int)
------------------------------------
91, docA, 1
92, docB, 3
93, docC, 2
94, docD, 1
95, docE, 4
and I need to sort it by status. Not to sort it numerically but alphabetically by names of those statuses.
Status names are different for every language.
English status names (for example):
1 = Draft
2 = For approval
3 = Approved
4 = Rejected
so correct alpabetical order of statuses is: 3, 1, 2, 4
and documents should be ordered like this:
Code:
id(int), title(varchar), status(int)
------------------------------------
92, docB, 3
91, docA, 1
94, docD, 1
93, docC, 2
95, docE, 4
but another user uses let's say Slovak language, where statuses have different alphabetical order.
Slovak status names (for example):
1 = Navrh
2 = Na schvalenie
3 = Schvaleny
4 = Neschvaleny
order: 2, 1, 4, 3
(the order can be different for every other language)
so documents would be ordered like this (for slovak language):
Code:
id(int), title(varchar), status(int)
------------------------------------
93, docC, 2
91, docA, 1
94, docD, 1
95, docE, 4
92, docB, 3
Is there any way how to do it in postgresql?