问题描述
选择子串(PHT_MSTR_Labs.LabName_short,13,13)为LabName_short,''为GraphColor,COUNT(PHT_IndentRequest.RequestID)为计数
FROM PHT_IndentRequest内连接PHT_MSTR_Labs ON PHT_MSTR_Labs.LabID = SUBSTRING( PHT_IndentRequest.RequestID,1,5)
LEFT外连接PHT_SamplingDetails ON PHT_IndentRequest.RequestID = PHT_SamplingDetails.RequestID
LEFT OUTER JOIN PHT_MSTR_Employees ON PHT_SamplingDetails.CollectorID = PHT_MSTR_Employees.EmployeeID
WHERE PHT_IndentRequest.RequestDate< ='2014/07/16'和
(PHT_SamplingDetails.DATE_rejection为null或PHT_SamplingDetails.DATE_rejection =''或
PHT_SamplingDetails.DATE_rejection> ='2014/07/16')和
PHT_IndentRequest.RequestID不在(从PHT_ReceivedSample中选择RequestID,其中Lab_ReceivedDate< ='2014/07/16'
)分组按PHT_MSTR_Labs.LabName_short
select substring(PHT_MSTR_Labs.LabName_short ,13,13) as LabName_short ,'' as GraphColor,COUNT(PHT_IndentRequest.RequestID )as count
FROM PHT_IndentRequest inner join PHT_MSTR_Labs ON PHT_MSTR_Labs.LabID = SUBSTRING(PHT_IndentRequest.RequestID, 1, 5)
LEFT outer join PHT_SamplingDetails ON PHT_IndentRequest.RequestID = PHT_SamplingDetails.RequestID
LEFT OUTER JOIN PHT_MSTR_Employees ON PHT_SamplingDetails.CollectorID = PHT_MSTR_Employees.EmployeeID
WHERE PHT_IndentRequest.RequestDate <= '2014/07/16' and
( PHT_SamplingDetails.DATE_rejection is null or PHT_SamplingDetails.DATE_rejection =''or
PHT_SamplingDetails.DATE_rejection >= '2014/07/16' ) and
PHT_IndentRequest.RequestID not in (Select RequestID from PHT_ReceivedSample where Lab_ReceivedDate <= '2014/07/16'
) group by PHT_MSTR_Labs.LabName_short
推荐答案
这篇关于本地系统返回Row,但在服务器返回没有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!