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 2005 Forums
 Transact-SQL (2005)
 migration script

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-06-26 : 04:19:33
hi i am having tables like
EMRPatientProblems
EMRUncodedProblems
EMRLocationMaster
EMRpatientsMaster
EMRDiagnosisCodesLkup

both EMRPatientProblems and EMRUncodedProblems are having three common columns in it like
PROBLEM_DESC,PROBLEM_CODE,STATUS

if the values are same for both tables then is_coded one column in
EMRPatientProblems tahtshould be updated to 1 as of now it is 0 for all rows .how can i achieve this?
and emruncodedproblems is having group_is column where emrpatientproblems is not having and emrlocationmaster is having group_is colukm where that values shold be taken into consideration.only based on the group specific i have to update the is_coded column values to 1.please help me out in this?

saran_d28
Starting Member

36 Posts

Posted - 2009-06-26 : 05:57:00
Hi,

Update T1 set is_coded = 1
From EMRPatientProblems T1
join EMRUncodedProblems T2
on T1.PROBLEM_DESC = T2.PROBLEM_DESC
and T1.PROBLEM_code = T2.PROBLEM_code
and T1.status = t2.status

--Sharan
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-06-26 : 07:08:25
can you give me it through select query statement as i have to update it through third table emrlocationmaster as group_id column is there based on that i have to give it and emrpatientsmaster table where location_id is on more column out there
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-26 : 14:01:05
can you post data in required format below

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -