Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

i have a table #temp1(id, Name groupname ) and record
like this 1 R1 S
2 R3 S
3 R2 S
4 R4 D
5 R5 D
6 R6 K
7 R7 K
8 R8 L
9 R9 L
10 R10 L
11 R11 K

and i want to display record based on user defind sorting
order e.g.
1 R4 D
2 R5 D
3 R6 K
4 R7 K
5 R11 K
6 R1 S
7 R3 S
8 R2 S
9 R8 L
10 R9 L
11 R10 L

Answer Posted / ram birendra jha

SELECT
case name
When 'R4' then 1
When 'R5' then 2
When 'R6' then 3
When 'R7' then 4
When 'R11' then 5
When 'R1' then 6
When 'R3'then 7
When 'R2'then 8
When 'R8' then 9
When 'R9' then 10
When 'R10' then 11
END as Id,
name,groupname FROM Tempid
ORDER BY Id

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the disadvantages of using querystrings to send data from one page to another?

1071


How to create a new schema in a database?

1208


How can you hide the sql server instances?

1072


What are the main sources of data?

1145


How to assign null values to variables or columns?

1027


What is query optimization process?

1081


Name the different type of indexes in sql?

1012


Explain the collation?

1149


What is a schema in ms sql server 2005?

1027


What do you understand by replication in sql server? Mention the different types of replication in sql server.

994


What is dknf in normalization form?

1112


How do I start sql server agent automatically?

1027


How to write the storeprocedure with in the store procedure? and how can we write the store procedure with in a trigger vice versa? plz post me the exact answer?

2631


how many type of indexing in database?

1021


What is a linked server in sql server?

1133