I have a grid with a field that uses an integer in my sql statement and I use lookup to display another value.
The lookup is done on another table, to give you an example:
Table A is the one used for the Grid, and it has the column “employeeID”
But I don’t want to show the employeeID, so I use a lookup, so it goes in my Table B (employee table), where I can get the Employee name based on the employeeID:
SELECT EmployeeName
FROM dbo.AllEmployees
WHERE EmployeeID= {employeeID}
ORDER BY EmployeeName
my issue is, that when I try to sort by this column in my Grid, it will use the “employeeID” to sort, and not the Lookup value (Display value) by ordering in alphabetical order based on Employees names!
How can I achieve this?