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 |
|
VeselaApo
Posting Yak Master
114 Posts |
Posted - 2011-01-19 : 11:43:34
|
| Hi,I have two tables with data. Table 1 has a list of all student IDs a blank column "Registration Status". The table looks like that:StudentID Registration Status001, Null002, Null003, Null004, Null005, Null...998, NullThe second table lists StudentIDs but NOT ALL of them and has the status of their registration as shown below:Student ID Status005, Enrolled046, Enrolled300, EnrolledI would like to update the Registration Status Column in Table 1 with the status Enrolled from Table 2 on all those students that T1.StudentID = t2.StudentID. The statement i tried is below but it does not work. Any suggestions?update T1set Registrationstatus = (select Status from T2 where T1.StudentID = t2.StudentID)where T1.StudentID = t2.StudentIDThanks! |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-01-19 : 12:30:14
|
update t1set Registrationstatus = t2.Statusfrom table1 as t1join table2 as t2 on t1.StudentId = t2.StudentId No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|