July 15, 2002 at 10:06 am
Is it possible to do an update statement using a self join? We are currenlty using a cursor.
I have oversimplified the example:
UPDATE table_x
SET b.elig_end_Date = a.elig_end_Date+1
FROM table_x a, table_x b
WHERE a.elig_tag<>b.elig_tag
Thanks!
-K
July 15, 2002 at 10:44 am
I got it,sorry:
UPDATE table_x
SET end_Date = b.end_Date
FROM table_x , table_x b
WHERE table_x.elig_tag<>b.elig_tag and table_x.elig_tag=1
July 15, 2002 at 11:27 am
Glad to hear, duplicate message see responses in http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=5463&FORUM_ID=8&CAT_ID=1&Topic_Title=can+you+UPDATE+with+a+self+join&Forum_Title=T%2DSQL%5B/url as well.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply