I have a result set where I want to apply a combined sort combined.
Example
SELECT Id, Name FROM Users
Result
Id Name
1 Albert
2 Alfred
3 Carl
4 David
5 Ernest
Now those users could be orderd by last access, last post, number of comments made or calculated parameters. How could i order if i have a SELECT like this:
SELECT Id, Name, function_last_access(Id) as f1, function_last_post(Id) as f2, function_calculate_parameters(Id) as f3 FROM Users
Id Name f1 f2 f3
1 Albert 2 100 1,1
2 Alfred 10 20 2
3 Carl 0 15 5
4 David 5 2 3
5 Ernest 4 5 1
It's better to take different ordered lists and combine them after? Or put them in columns and then apply a normalization function and then sort them?
Could help me ORDER BY PARTITION or something like that?