add this in the Inner QueryWHERE FACILITY_KEY = 'ACCU' AND A.GCN_SEQNO = 18370
SELECT A.GCN_SEQNO, A.SUBST_INSTRUCTIONS FROM OGEN.NDC_M_FORMULARY AINNER JOIN(SELECT GCN_SEQNO, MAX(SUBST_INSTRUCTIONS) LATEST_SUBSTFROM OGEN.NDC_M_FORMULARY WHERE FACILITY_KEY = 'ACCU' AND A.GCN_SEQNO = 18370group by GCN_SEQNO) ABCON A.SUBST_INSTRUCTIONS = ABC.LATEST_SUBST AND A.GCN_SEQNO = ABC.GCN_SEQNOWHERE FACILITY_KEY = 'ACCU' AND A.GCN_SEQNO = 18370GROUP BY A.GCN_SEQNO , A.SUBST_INSTRUCTIONS ,ABC.LATEST_SUBST
sabinWeb MCP