Clarity

SQL: Clarity SQL and limiting results to TOP #

February 17, 2012
By

In Clarity you can’t use FETCH or LIMIT. So I just get the TOP # result, as such: SELECT TOP 2 SPECIALTY, CONTACT_DATE FROM PATIENT INNER JOIN (PAT_ENC INNER JOIN CLARITY_DEP ON PAT_ENC.DEPARTMENT_ID = CLARITY_DEP.DEPARTMENT_ID) ON PATIENT.PAT_ID = PAT_ENC.PAT_ID WHERE PATIENT.PAT_MRN_ID=’********’ AND CONTACT_DATE < ’02/17/2012′ AND SPECIALTY = ‘Nephrology’ ORDER BY CONTACT_DATE DESC It...

Read more »

SQL: Clarity and order medications

August 30, 2011
By

SELECT * FROM ORDER_MED Where ORDER_MED.PAT_ID = PATIENT.PAT_ID AND PATIENT.PAT_MRN_ID = ’1100xxxxxxxx’ AND Current_Date < ORDER_MED.END_DATE ORDER BY ORDERING_DATE DESC;

Read more »

SQL: Clarity and encounters

August 30, 2011
By

$sql= “SELECT SPECIALTY, EXTERNAL_NAME, CONTACT_DATE FROM PATIENT INNER JOIN (PAT_ENC INNER JOIN CLARITY_DEP ON PAT_ENC.DEPARTMENT_ID = CLARITY_DEP.DEPARTMENT_ID) ON PATIENT.PAT_ID = PAT_ENC.PAT_ID WHERE PATIENT.PAT_MRN_ID=’”.$mrn_long.”‘ ORDER BY NOTED_DATE DESC”;

Read more »