SELECT Q.QRYNAME , Q.DESCR , Q.LASTUPDDTTM FROM PSQRYDEFN Q WHERE Q.OPRID = ' ' AND Q.QRYTYPE = 1 AND NOT EXISTS ( SELECT 'X' FROM PSQRYBIND B WHERE B.OPRID = Q.OPRID AND B.QRYNAME = Q.QRYNAME AND B.USECOUNT > 0) AND NOT EXISTS ( SELECT 'X' FROM PSQRYSELECT S WHERE S.OPRID = Q.OPRID AND S.QRYNAME = Q.QRYNAME AND S.SELECTTYPE IN (1, 3) AND NOT EXISTS ( SELECT 'X' FROM PSQRYRECORD R WHERE R.OPRID = S.OPRID AND R.QRYNAME = S.QRYNAME AND R.SELNUM = S.SELNUM AND R.JOINTYPE = 1 AND R.RECNAME = 'BO_BASIC_IND'))
|