2 improved formatting
source | link

use msdb go select s.job_id, s.name as jobname, h.step_id, h.step_name, case when run_status = 0 then 'Failed' when run_status = 1 then 'Succeeded' when run_status = 2 then 'Retry' when run_status = 3 then 'Canceled' when run_status = 4 then 'In Progress' end as runstatus , h.message , h.run_date , h.run_time , h.run_duration as 'dusration(s)' from dbo.sysjobs as s inner join dbo.sysjobhistory as h on s.job_id = h.job_id order by h.run_date desc, h.run_time desc

use msdb
go
select 
s.job_id, 
s.name as jobname, 
h.step_id, 
h.step_name,
case when run_status = 0 then 'Failed'
when run_status = 1 then 'Succeeded'
when run_status = 2 then 'Retry'
when run_status = 3 then 'Canceled'
when run_status = 4 then 'In Progress'
end as runstatus ,
h.message ,
h.run_date ,
h.run_time ,
h.run_duration as 'dusration(s)'
from dbo.sysjobs as s
inner join  dbo.sysjobhistory as h on s.job_id = h.job_id
order by h.run_date desc, h.run_time desc

use msdb go select s.job_id, s.name as jobname, h.step_id, h.step_name, case when run_status = 0 then 'Failed' when run_status = 1 then 'Succeeded' when run_status = 2 then 'Retry' when run_status = 3 then 'Canceled' when run_status = 4 then 'In Progress' end as runstatus , h.message , h.run_date , h.run_time , h.run_duration as 'dusration(s)' from dbo.sysjobs as s inner join dbo.sysjobhistory as h on s.job_id = h.job_id order by h.run_date desc, h.run_time desc

use msdb
go
select 
s.job_id, 
s.name as jobname, 
h.step_id, 
h.step_name,
case when run_status = 0 then 'Failed'
when run_status = 1 then 'Succeeded'
when run_status = 2 then 'Retry'
when run_status = 3 then 'Canceled'
when run_status = 4 then 'In Progress'
end as runstatus ,
h.message ,
h.run_date ,
h.run_time ,
h.run_duration as 'dusration(s)'
from dbo.sysjobs as s
inner join  dbo.sysjobhistory as h on s.job_id = h.job_id
order by h.run_date desc, h.run_time desc
1
source | link

use msdb go select s.job_id, s.name as jobname, h.step_id, h.step_name, case when run_status = 0 then 'Failed' when run_status = 1 then 'Succeeded' when run_status = 2 then 'Retry' when run_status = 3 then 'Canceled' when run_status = 4 then 'In Progress' end as runstatus , h.message , h.run_date , h.run_time , h.run_duration as 'dusration(s)' from dbo.sysjobs as s inner join dbo.sysjobhistory as h on s.job_id = h.job_id order by h.run_date desc, h.run_time desc