I want to sort a table in SQL Server 2008 by using one column and arrange the whole table through that column. Similar to the Excel function that sorts by values and expands the sort throughout the whole row.
For example table is composed as follows:
ID NameID Value1 Value2
0 10210 -1 0
0 3201 -1 1
1 12051 -1 1
1 11210 -1 0
1 3650 -1 0
If I want to sort the table by using the NameID column how would I go about doing that? Is it only possible to use a SELECT query of some sort, how would I go about editing it in that view?
Same goes with a table using strings instead of just numbers, is it possible to sort from A-Z or Z-A?
Using SQL Server 2008.
Try this
you can also do this