修改查询以仅显示 patientid 而非 null

Modify query to show only patientid not null

SELECT patientname, patientID
 (CASE WHEN patientid is not null THEN 'yes'
             WHEN patientid is null then 'No'    
        END) as diagnosedornot

FROM database
where diagnosetime between '2020-09-03' and '2020-09-04'

有没有办法重写此查询以仅显示 patientID 不为空,我的意思是显示仅显示 patientID 不为空的数据。最好的方法是什么,用例?或者这甚至可能吗?

我想优化这个查询。

使用 where 子句过滤非 null patientids:

的行
select patientname
from database
where 
    diagnosetime between '2020-09-03' and '2020-09-04' 
    and patientid is not null