Link to home
Start Free TrialLog in
Avatar of szadroga
szadrogaFlag for United States of America

asked on

How to sort and existing table in SQL (SMMS 2005)

I currently have a table already in production that would like to add a sort to (GROUP BY field ASC).  The table currently is just sorted by the PK in an ascending order.  i would like to sort on another field.  

The table is used as a backend storage for a web app.  So by the sorting the table on the backend, I would like the usernames sorted on the front end web app.
ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Raja Jegan R
My basic question here is why you need to store the Grouped and Sorted values in the table itself.
Instead trying to sort the table you can have the current Primary Key which sorts the data physically in that table and then whenever you fetch the records from the table, query using appropriate GROUP BY and Sortings.