我希望能够pa.NumberOfPages
从dm_package pa
以下选择语句中选择列。我怎样才能做到这一点?
选择语句 1
SELECT
Case When IsPackage = 1 then 'DM, Package' else 'DM' end as FaxType,
FaxId, RequestDate, FaxedTo, FaxNumber, Status, ExtendedStatus, StatusDate,
UserName, IsPackage, DocumentId, -1 as PatientMedicationId, '' as Event,
'-1' as NCPDPID, 0 as IsEPerscription, -1 as AccessionNumber,
Case When IsPackage = 0 then
(Select FilePath from PatientDocument where DocumentId = fl.DocumentId and ( '443' = -1 or '443' = PatientId ))
else (Select FilePath from dm_Package where fl.DocumentId = PackageId and ( '443' = -1 or '443' = PatientId )) End as Path,
Case When IsPackage = 0 then
(Select LastFirstName from Patient p, PatientDocument pd where fl.DocumentId = pd.DocumentId and pd.PatientId = p.PatientId)
else (select LastFirstName from Patient p, dm_Package pa where fl.DocumentId = pa.PackageId and pa.PatientId = p.PatientId) END as LastFirstName,
Case When IsPackage = 0 then
(select [Description] from PatientDocument where fl.DocumentId = DocumentId and ( '443' = -1 or '443' = PatientId ))
else (select PackageName from dm_Package where fl.DocumentId = PackageId and ( '443' = -1 or '443' = PatientId )) End as [Description],
'' as JobId, -1 as SeqNumber, '' as RefNumber, (select DocId from dbo.PatientDocument pd where fl.DocumentId = pd.DocumentId) as DocId
FROM dbo.dm_FaxLog fl
表名dm_package pa
pa.IsFax, pa.FaxName, pa.faxNumber, pa.FilePath, pa.DocRoot, pa.Note, pa.PatientId,
isnull(fl.ExtendedStatus,'') as FaxExtendedStatus, StatusDate as FaxStatusDate, pa.DocId, pa.NumberOfPages