Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT "P"."Id" "PatientId"
- FROM "Patient" "P"
- INNER JOIN (
- SELECT
- "_PPFIS".*,
- "_PP"."PatientId" "PatientId"
- FROM "ProcessPatientFamilyIncomeStatement" "_PPFIS"
- INNER JOIN "ProcessPatient" "_PP" ON "_PP"."Id" = "_PPFIS"."ProcessPatientId"
- WHERE "_PPFIS"."Id" = (
- SELECT TOP 1"__PPFIS"."Id"
- FROM "ProcessPatientFamilyIncomeStatement" "__PPFIS"
- INNER JOIN "ProcessPatient" "__PP" ON "__PP"."Id" = "__PPFIS"."ProcessPatientId"
- WHERE "__PP"."PatientId" = "_PP"."PatientId"
- ORDER BY "__PPFIS"."LastUpdateDate" DESC
- )
- ) "PPFIS" ON "PPFIS"."PatientId" = "P"."Id"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement