谁能告诉我以下查询中有什么问题?
select case
when ANALYSISCODE is null and
studydomainmdata.studydomainmetadataid > 0
then 'CD'
when ANALYSISCODE is null and
studydomainmdata.studydomainmetadataid < 0
then 'CD1'
when analysiscode is not null
then ANALYSISCODE
else 'N/A'
end as ANALYSISCODE
from studyanalysis
inner join (slmetadata
inner join studydomainmdata
on slmetadata.slmetadataid = studydomainmdata.slmetadataid and
studydomainmdata.studydomainmetadataid=-9)
on studyanalysis.analysisid = slmetadata.analysisid;
我的预期结果是:
- CD1 如果 studydomainmetadataid 小于 0
- CD 如果 studydomainmetadataid > 0 (i,e 85)
- 'xxx' 如果 ANALYSISCODE 不为空
我得到空的 ANALYSISCODE。