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 |
|
ben_53
Yak Posting Veteran
67 Posts |
Posted - 2011-08-25 : 20:28:41
|
| I have my_tablewith 3 columnscol1 = refnumcol2 = seqnumnow there can be 'n' ref numbersif certain condition is met and we find ref num 3, then the order starts from 3 for seqnumhere is sample data: (there is match for say refnum = 02)refnum seqnum01 0201 0201 0202 0102 0103 0303 0303 0303 03 .......so if condition finds ref num = 2, then in seqnum, 2 becomes 1 and 1 becomes 2 and so on...Another example: (condition met at refnum = 3) refnum seqnum01 0202 0302 0302 0303 0103 0104 0404 0405 05...kindly note that there can be 1000's of ref numbers I cant hardcode it.needs a logic. THANKS |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-08-25 : 21:21:03
|
quote: I have my_tablewith 3 columns
You only show us 2 column. What's the 3rd column ? quote: if certain condition is met and we find ref num 3, then the order starts from 3 for seqnum
what condition ? ref num 3 is the input ?Really don't quite understand what do you want here. What you have posted is the sample data right ? Can you show us the corresponding expected result ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|