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)
 UPDATE STATEMENT ON SELF JOIN

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-01-29 : 09:00:31
jaideep writes "hi,
i have a table on which i need to do updates.its a self-referncing join.in the example below i need to update the fname and lname fields.

SSN COURSEID FNAME LNAME
111-11-111 2023 JOHN SMITH
111-11-111 2354 NULL NULL

wht should be the sql syntax...
any suggestions are welcome......"

SamC
White Water Yakist

3467 Posts

Posted - 2003-01-29 : 09:34:33

UPDATE MyTableName
SET Fname='Bob', Lname='Shenoy'
WHERE SSN = '123-456-7899'

For more information, have a look at UPDATE in SQL Books Online.

Sam



Edited by - SamC on 01/29/2003 10:05:33
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-29 : 09:53:47
Why are you storing the FNAME AND LNAME in the studentcourses table? All you require are the ssn and courseid and ssn with a relationship to the students table and another to the courses table. Then you won't need to update the courses table everytime the students table changes.


http://www.swynk.com/friends/faour/databasedesign1.asp



Go to Top of Page
   

- Advertisement -