This might do? Set to only show the most recent execution. STEPs that are not executed will show as NULL (so could use IsNull() to display a message instead)
This presupposes that the current STEPS defined for the Job are the same as the steps that existed when the job actually ran!!
SELECT J.job_id
, J.enabled
, [JobName] = CASE WHEN S.last_run_outcome = 1 THEN '' ELSE '*** ' END
+ COALESCE(J.name, '(No name)')
, S.step_id
, S.last_run_outcome
, S.last_run_duration
, S.last_run_date
, S.last_run_time
, [StepName] = CASE WHEN S.last_run_outcome = 1 THEN '' ELSE '*** ' END
+ COALESCE(S.step_name, '(No name)')
, H.step_id
, H.sql_message_id
, H.sql_severity
, H.run_status
, H.run_date
, H.run_time
, H.run_duration
-- , H.operator_id_emailed
-- , H.server
, H.message
, H.step_name
-- , S.database_name
-- , J.description
FROM msdb.dbo.sysjobs AS J
JOIN
(
-- Lowest Step ID for the Job
SELECT [S_RowNo] = ROW_NUMBER() OVER (PARTITION BY S0.job_id ORDER BY S0.step_id)
, S0.job_id
, S0.step_id
, S0.last_run_outcome
, S0.last_run_duration
, S0.last_run_retries
, S0.last_run_date
, S0.last_run_time
FROM msdb.dbo.sysjobsteps AS S0
) AS S0
ON S0.job_id = J.job_id
JOIN msdb.dbo.sysjobsteps AS S
ON S.job_id = J.job_id
LEFT OUTER JOIN msdb.dbo.sysjobhistory AS H
ON H.job_id = J.job_id
AND H.step_id = S.step_id
AND (H.run_date > S0.last_run_date OR (H.run_date = S0.last_run_date AND H.run_time >= S0.last_run_time))
WHERE S_RowNo = 1
ORDER BY J.enabled DESC
, S0.last_run_date DESC
, S0.last_run_time DESC
, J.name
, S.step_id
I tried a variation on this which uses "History Zero" instead of "Step Zero" to determine the most recent execution time, and that could be adapted to EVERY Execution Time [of Step Zero] to provide a report of all executions [within a date/time range].
Doing this has reminded me of how shoddy MS's code is for things like this. Run Date and Time as 6-digit integers - really? Shame on MS ... it has all the appearance of being thrown together, along with Maintenance Plans, by a Summer Intern AND not checked / approved by someone more senior.