Solved

Microsoft, SQL, 2005, Update Script help

Posted on 2008-10-17
4
503 Views
Last Modified: 2010-04-21
I want to update type of bill from 738 to 731 where the visit owner equals 6

Started it but its not going well ... any help is appreciated.

UPDATE PatientVisitFiling pvf FROM
INNER JOIN PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
SET pvf.TypeOfBill = '731' WHERE pv.VisitOwnerMId = '6'
0
Comment
Question by:Jeff S
4 Comments
 
LVL 22

Accepted Solution

by:
dportas earned 200 total points
ID: 22743808
UPDATE PatientVisitFiling
SET TypeOfBill = '731'
WHERE EXISTS
(SELECT 1
 FROM PatientVisit pv
 WHERE pv.PatientVisitId = PatientVisitFiling.PatientVisitId
  AND pv.VisitOwnerMId = '6');
0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 200 total points
ID: 22743828
UPDATE PatientVisitFiling
SET TypeOfBill = '731'
FROM PatientVisitFiling pvf INNER JOIN
      PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
WHERE pv.VisitOwnerMId = '6'
0
 
LVL 9

Assisted Solution

by:vavjeeva
vavjeeva earned 100 total points
ID: 22743851
try this .. it should work

UPDATE PatientVisitFiling SET TypeOfBill = '731'  FROM PatientVisitFiling pvf
INNER JOIN PatientVisit pv ON pvf.PatientVisitId = pv.PatientVisitId
WHERE pv.VisitOwnerMId = '6'
0
 
LVL 7

Author Closing Comment

by:Jeff S
ID: 31507236
Split points to be fair ....  wish i could give all full credit
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question