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 |
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2010-12-24 : 07:53:20
|
| dear all,my result is like this218 1 4949 80864272 2 4207 77781i want result to be like this below100 1 4949 80864100 1 4949 8086418 1 4949 80864100 2 4207 77781100 2 4207 7778172 2 4207 77781plz anybody advice |
|
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-12-24 : 07:59:36
|
| What version of sql server you are using ? |
 |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2010-12-24 : 08:00:40
|
| 2008 r2 |
 |
|
|
Devart
Posting Yak Master
102 Posts |
Posted - 2010-12-24 : 08:38:29
|
| Hello,For example:create table t_test(id1 int,id2 int,id3 int,id4 int);insert into t_test values(218,1,4949,80864);insert into t_test values(272,2,4207,77781);goWITH _test AS( SELECT id1 AS id1,id2,id3,id4 FROM t_test UNION ALL SELECT id1-100 AS id1,id2,id3,id4 FROM _test WHERE id1-100>0)SELECTCASE WHEN id1<100 THEN id1 ELSE 100 END AS id1,id2,id3,id4FROM _testORDER BY id2,id1 DESC;Devart,SQL Server Tools:dbForge Schema ComparedbForge Data ComparedbForge Query Builder |
 |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2010-12-27 : 00:19:51
|
| thanks devart |
 |
|
|
|
|
|
|
|