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 |
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2007-03-27 : 03:04:27
|
| I have one table as followPlanName Category NamePayment Discount ABCPayment Discount XYZPayment variance 123Payment variance 345Contract General PQR Contract General MNOContract General JKLContract General HISI want to shift the HIS record after 345 record.My result should be PlanName Category NamePayment Discount ABCPayment Discount XYZPayment variance 123Payment variance 345Contract General HISContract General PQR Contract General MNOContract General JKLPlease tell me how I can shift the data |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-27 : 03:08:22
|
| Use ORDER BYSELECT * FROM Table1ORDER BY PlanName DESC, Category, CASE WHEN Name = 'HIS' THEN 0 ELSE 1 END, Name DESCPeter LarssonHelsingborg, Sweden |
 |
|
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2007-03-27 : 03:16:56
|
| i want to save the shifted data into table.How I can update the tableSQLTeam |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-27 : 03:18:59
|
| The order of records in a relational database has no meaning! Only when presenting the data, the order can have meaning.Why is this so important to you?Peter LarssonHelsingborg, Sweden |
 |
|
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2007-03-27 : 03:19:57
|
| also i don't want to change the existing order of Name.SQLTeam |
 |
|
|
|
|
|