Paul's probably right.. putting the sorting values in a table would be eaiser
to maintain. I don't know what I was thinking with the whole "then you don't
HAVE to create a table". Both ways work.. but especially if you think the
positions may change, then it'll be tons easier to update if th
= = = Original message = = =
I need to sort the results of a DB query based on the hierarchy of positions
within an organization. Since they are not necessarily alphabetical, the
best I can come up with is to assign a numerical value in a separate table
to each position, and reference that to so
Well, kind of ugly but you can do something like this:
SELECT Position, CASE Position WHEN 'CEO' THEN 1 WHEN 'COO' THEN 2 WHEN 'CFO'
THEN 3 WHEN 'HR' THEN 4 ELSE 99 END AS PositionSort
FROM SomeTable
ORDER BY PositionSort
That way you're not creating a whole new table to store the sorting value
I have been trying to figure out how to get this to work for a couple of
days.
I need to sort the results of a DB query based on the hierarchy of positions
within an organization. Since they are not necessarily alphabetical, the
best I can come up with is to assign a numerical value in a separa
4 matches
Mail list logo