Hi,
When you said a patient with no admission order, is it a patient without any records in your Horder table? if it is the case, you need to do this,
SELECT DISTINCT a.PatientAccountID
,a.VisitStartDateTime
FROM PatientVisitInfo a with (nolock)
LEFT JOIN HOrder b with (nolock)
ON a.PatientVisit_oid=b.PatientVisit_oid
WHERE a.VisitTypeCode='IP'
AND a.VisitStartDateTime >= GETDATE()-1
AND b.PatientVisit_oid IS NULL
ORDER BY a.PatientAccountID
Now if you want the patient not having b.OrderAbbr, use a sub query and left join.
SELECT DISTINCT a.PatientAccountID
,a.VisitStartDateTime
FROM PatientVisitInfo a with (nolock)
LEFT JOIN (SELECt * FROM HOrder with (nolock)
WHERE b.OrderAbbr = 'A_AdmitObs'
or b.OrderAbbr = 'A_AdmitInpt'
or b.OrderAbbr = 'A_CngInpt'
or b.OrderAbbr = 'A_CngObs') AS B
ON a.PatientVisit_oid=b.PatientVisit_oid
WHERE a.VisitTypeCode='IP'
AND a.VisitStartDateTime >= GETDATE()-1
AND b.PatientVisit_oid IS NULL
ORDER BY a.PatientAccountID
Let me know which one could work for you.