如何将这 2 个查询合并为一个查询并...
select cp.TouchedWhen,
U.DisplayName AS 'ATTENDING'
from SXAAMBClientPrescription CP (nolock)
inner join CV3User U (nolock) on U.GUID = CP.CareproviderGUID
Order by CP.TouchedWhen ASC
select cp.TouchedWhen,
U.DisplayName AS 'RESIDENT'
from SXAAMBClientPrescription CP (nolock)
inner join CV3User U (nolock) on U.GUID = CP.UserGUID
order by CP.TouchedWhen ASC
输出应该是:
TouchedWhen | Attending | Resident
9/16/13 | Dr Joe | Resident Schmo
如果 TouchedWhen 在 2 个查询中匹配,则参加者和居民应该像上面一样在同一行中。否则填写主治人员和居民,但他们出现。
谢谢你。