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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Can't figure this out

Author  Topic 

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-08-05 : 05:11:23
Hi all,

I have the following table :

MemberKey, Comment
1, 'Joined Scheme'
1, 'Left Scheme'
1, 'Rejoined Scheme'
2, 'Joined Benefit'
2, 'Salary increase'

etc...

What I would like is to add another column SUBJECT which will hold something like CONV01, CONV02 etc

So we will have :

MemberKey, Comment, SUBJECT
1, 'Joined Scheme',CONV01
1, 'Left Scheme', CONV02
1, 'Rejoined Scheme', CONV03
2, 'Joined Benefit', CONV01
2, 'Salary increase', CONV02

etc..

Suggestions? (non cursor solutions of course kuz like, that's too easy )


----------------
Shadow to Light

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-08-05 : 05:36:49
Hi Amethystium!! :)

update t set subject = 'conv' +

(select count(*) from t tt where tt.memberkey=t.memberkey and

tt.comment <= t.comment)

- Vit
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-08-05 : 05:56:07
Thanks Vit!

How is the plant programming doing?
Any new leaves yet?

----------------
Shadow to Light
Go to Top of Page

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-08-05 : 06:06:55
Wow!! How did you guess?
Just yesterday I bought a rhododendron bushlet...

- Vit
Go to Top of Page
   

- Advertisement -