I have a query of the structure
SELECT DISTINCT
--parameters
[ProjectNum] = dbo.ProjNumFunction(P.A, P.B, P.C, P.D, P.E)
--other parameters
FROM dbo.Project P
WHERE --conditions
ORDER BY --parameter
ProjNumber function simply takes values of A, B, C, D, and E from the Project table, and concatenates them into a single string, which looks like 'A B C D E'.
I need to order by one of these parameters inside the function WITHOUT placing them into my select list. Is it possible?
The following thread (and the second) were the closest I got, but it is not what I need.
EDIT
I have tried using statements below, and the results are
ORDER BY SUBSTRING(ProjectNumber, 9, 13) desc --Invalid column name error
and
[ProjectNumber] = CONCAT(P.A, P.B, P.C, P.D, P.E)
-- it concatinated successfully, but still does not allow me to order by any of those
-- parameters without including onto select list