SQL Query to get Control-M jobs not in use

Version 1
    Share This:

    SELECT T1.APPLICATION, T1.GROUP_NAME, T1.JOB_NAME

      FROM [em900].[dbo].[DEF_VER_JOB] T1

      LEFT JOIN [em900].[dbo].[RUNINFO_HISTORY] T2

      ON T1.JOB_NAME = T2.JOB_MEM_NAME

      AND T1.GROUP_NAME = T2.GROUP_NAME

      AND T1.APPLICATION = T2.APPLICATION

      WHERE T1.IS_CURRENT_VERSION='Y'

      AND T2.JOB_MEM_NAME IS NULL

      ORDER BY T1.APPLICATION, T1.GROUP_NAME, T1.JOB_NAME