Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-12-01 : 08:38:06
|
| shibu writes "I have a table 'manage_user_types' and its primary key is 'Category_ID'. There is another field 'Category_Parent_ID' which refers the 'Category_ID' in the same table. And one more field is 'Category_Name' which is related to 'Category_ID'. ie.when displaying the table in front end, 'Category_Name' is displayed under 'Category_Parent_ID'. I want to sort the table with 'Category_Name' when clicking the 'Category_Parent_ID' to sort. What should i do?" |
|
|
Sean_B
Posting Yak Master
111 Posts |
Posted - 2006-12-01 : 09:09:51
|
| Hi Shibu,Are you looking for something like this ?*--input data--insert into manage_user_types select 1,1,'First' union allselect 2,1,'Second' union allselect 3,1,'Third' union allselect 4,2,'Fourth' ------query---select Category_ID,Category_Parent_ID,Category_Namefrom manage_user_types manwhere man.Category_Parent_ID = 1order by man.Category_Name asc--which gives the resultsCategory_ID Category_Parent_ID Category_Name1 1 First2 1 Second3 1 Third?Sean |
 |
|
|
|
|
|