I have a query that's basically like and the output looks like what follows it.
I can get the 3rd party reporting tool in which I place the sql script to take care of everything but
what you see for the repeating of the statuses and catalog years.
Is there a way to make these columns independent and just list as they are? I've tried using temp tables, CTEs but still get the same results.
SELECT P.PROGRAM_ID,
PL.TYPE,
S.STATUSES,
PL.CATALOG_YEARS,
PL.DEPARTMENT
FROM ACAD_PROGRAMS P
LEFT JOIN ACAD_PROGRAMS_LS PL ON P.PROGRAM_ID = PL.PROGRAM_ID -- (MULTIPLE VALUES FOR PROGRAM_ID)
LEFT JOIN STATUSES S ON P.PROGRAM_ID = S.PROGRAM_ID -- (MULTIPLE VALUES FOR PROGRAM_ID)
program id type statuses catalog years department
ABC XX A 2015 DEP1
ABC XX P 2015 DEP1
ABC XX I 2015 DEP1
ABC XX A 2016 DEP1
ABC XX P 2016 DEP1
ABC XX I 2016 DEP1
ABC XX A 2017 DEP1
ABC XX P 2017 DEP1
ABC XX I 2017 DEP1
Would like the output to be
ABC XX A 2015 DEP1
ABC XX P 2016 DEP1
ABC XX I 2017 DEP1
I can get the 3rd party reporting tool in which I place the sql script to take care of everything but
what you see for the repeating of the statuses and catalog years.
Is there a way to make these columns independent and just list as they are? I've tried using temp tables, CTEs but still get the same results.
SELECT P.PROGRAM_ID,
PL.TYPE,
S.STATUSES,
PL.CATALOG_YEARS,
PL.DEPARTMENT
FROM ACAD_PROGRAMS P
LEFT JOIN ACAD_PROGRAMS_LS PL ON P.PROGRAM_ID = PL.PROGRAM_ID -- (MULTIPLE VALUES FOR PROGRAM_ID)
LEFT JOIN STATUSES S ON P.PROGRAM_ID = S.PROGRAM_ID -- (MULTIPLE VALUES FOR PROGRAM_ID)
program id type statuses catalog years department
ABC XX A 2015 DEP1
ABC XX P 2015 DEP1
ABC XX I 2015 DEP1
ABC XX A 2016 DEP1
ABC XX P 2016 DEP1
ABC XX I 2016 DEP1
ABC XX A 2017 DEP1
ABC XX P 2017 DEP1
ABC XX I 2017 DEP1
Would like the output to be
ABC XX A 2015 DEP1
ABC XX P 2016 DEP1
ABC XX I 2017 DEP1