Tryign to hid an unused operatroy, but OD tells me there are appointments in the future tied to that op. HOw do I find out where they are?
Thanks
find appointments assigned to a operatory
-
- Posts: 129
- Joined: Sat Jun 12, 2010 3:18 pm
Re: find appointments assigned to a operatory
Query 848 will work for that. Just set the operatory name and VISIBLE up top.
Code: Select all
/*848 Scheduled appointments in specific operatory.*/
/*Query code written/modified: 01/17/2017*/
SET @OperatoryName='%%';/*To search for all Operatories, set OperatoryName='%%'*/
SET @OperatoryVisibility='HIDDEN';/*Accepted inputs are 'VISIBLE' or 'HIDDEN'. All other inputs will default to 'HIDDEN'.*/
SELECT p.PatNum AS 'Pat#',p.LName, p.FName, DATE_FORMAT(ap.AptDateTime,'%m/%d/%Y - %h:%i %p') AS 'Appt Date/Time', op.OpName AS 'Operatory'
FROM appointment ap
INNER JOIN operatory op ON op.OperatoryNum=ap.Op
AND (CASE WHEN @OperatoryVisibility LIKE '%HIDDEN%' THEN op.IsHidden=1
ELSE op.IsHidden=0 END)
AND op.OpName LIKE @OperatoryName
INNER JOIN patient p ON p.PatNum=ap.PatNum
WHERE ap.AptStatus IN (1,4)
ORDER BY op.OpName, ap.AptDateTime;
-
- Posts: 129
- Joined: Sat Jun 12, 2010 3:18 pm
Re: find appointments assigned to a operatory
Glad to be of help!