I want to update the table FD__Agency_Admission with the results from a sql select query saved it as a View called TLV__ES_AgencyDischargeDates.
I want to do something like this:
Update FD__Agency_Admission
Set Discharge_Date = '12/31/2004'
Where Discharge_Date is null
How do I use the FamilyKey results in the view to UPDate the FD__Agency_Admission Table where the FamilyKey from the matches the FamilyKey in TLV__ES_AgencyDischargeDates?
Here's the original sql query:
SELECT t.FamilyKey, t.ProgramCode
FROM dbo.TLV_NullDischargeDate t INNER JOIN
(SELECT FamilyKey
FROM TLV_NullDischargeDate
GROUP BY FamilyKey
HAVING COUNT(FamilyKey) = 1) a
ON t.FamilyKey = a.FamilyKey
WHERE (t.ProgramCode = 6)
Results:
FamilyKey ProgramCode
84684 6
87510 6
88721 6
84362 6
I want to do something like this:
Update FD__Agency_Admission
Set Discharge_Date = '12/31/2004'
Where Discharge_Date is null
How do I use the FamilyKey results in the view to UPDate the FD__Agency_Admission Table where the FamilyKey from the matches the FamilyKey in TLV__ES_AgencyDischargeDates?
Here's the original sql query:
SELECT t.FamilyKey, t.ProgramCode
FROM dbo.TLV_NullDischargeDate t INNER JOIN
(SELECT FamilyKey
FROM TLV_NullDischargeDate
GROUP BY FamilyKey
HAVING COUNT(FamilyKey) = 1) a
ON t.FamilyKey = a.FamilyKey
WHERE (t.ProgramCode = 6)
Results:
FamilyKey ProgramCode
84684 6
87510 6
88721 6
84362 6