Blame | Last modification | View Log | Download | RSS feed
select
device.name as 'Device',
client.name as 'Client',
maintenance_task.description as 'Task',
maintenance_schedule.schedule as schedule,
date_format(max(maintenance_performed.maintenance_date),'%Y-%m-%d') as 'Last Performed',
date_format(adddate(max(maintenance_performed.maintenance_date),maintenance_schedule.schedule),'%Y-%m-%d') as 'Next Due'
from
maintenance_schedule join maintenance_task using (maintenance_task_id)
join device using (device_id)
join maintenance_performed using (maintenance_task_id,device_id)
join site using (site_id)
join client using (client_id)
where
maintenance_schedule.removed_date is null
and device.removed_date is null
group by
device.name,
maintenance_task.description
order by
client.name,
device.name,
maintenance_task.description
;