First, an example of the data I'm working with:
What I need to do is fill a ListBox with the DISTINCT values from Column1 but keep them in the order they would be sorted in if they were ORDERED BY Column2.
From what I've read, it isn't possible to do this within the SQL Query. If I do
the result is in alphabetical order instead of ordered by Column2.
Is it possible to achieve the results I'm aiming for by filtering a DataTable filled with the subquery above?
Code:
Column1 Column2
C 1
A 2
C 3From what I've read, it isn't possible to do this within the SQL Query. If I do
SQL Code:
SELECT DISTINCT Column1 FROM (SELECT TOP 100 Column1, Column2 FROM TABLE ORDER BY Column2) AS Test
the result is in alphabetical order instead of ordered by Column2.
Is it possible to achieve the results I'm aiming for by filtering a DataTable filled with the subquery above?