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 |
|
H
Starting Member
23 Posts |
Posted - 2012-01-23 : 18:00:29
|
| I am new to sql Need help with 1 queryTable name:1. Patient_masterFields: patient_id, firstname, lastname, doctor_id, address,….. 2. case_masterFields: case_id, case-no, description, start_date, case_start_date, doctor_id, ….I want to make doctor_id from case_master equal to doctor_id on patient_master(I mean replace doctor_id on case_master with doctor_id on Patient_master)FYI Emp_master has doctor_id and doctor first name , last name I tired this but this did not helpupdate case_master, patient_master set case_master.doctor_id = patient_master.doctor_idThanksH |
|
|
Jaypoc
Yak Posting Veteran
58 Posts |
Posted - 2012-01-23 : 18:53:52
|
In order to set the doctor ID's to match, you need to specify what you're matching based on.UPDATE case_masterSET case_master.doctor_id = (SELECT doctor_id FROM patient_master WHERE patient_master.<somefield> = case_master.somefield) |
 |
|
|
H
Starting Member
23 Posts |
Posted - 2012-01-24 : 17:28:21
|
| thanks for your reply |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
H
Starting Member
23 Posts |
Posted - 2012-01-24 : 23:19:44
|
| thanks |
 |
|
|
|
|
|
|
|