Solved

Microsoft, SQL, 2005, Update Script help

Posted on 2008-10-17
4
464 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Split points to be fair ....  wish i could give all full credit
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Temporarily disable SQL Replication 7 21
SQL Server Log File Space 6 33
MS SQL Backup 24 69
Date conversion in sql server 2012 6 25
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now