3HEMN2Q2XKIYKGTYSYOR7SYL44SHI6UHXHQQ564AI6G2KQGYWBDAC
Z4KRJX4QVMQ5F233DC3XMSE5ZJYHKX3UF5QWAGHDC54EC5NUBXUQC
SZYY2EQQK2JUAHMDPBASGWC2RON2GA5G6FHBLO4GAAX2XTM6QLSQC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
(select project, jobset, job, system, max(id) as id
(select (select max(id) from builds b where project = activeJobs.project and jobset = activeJobs.jobset and job = activeJobs.job and system = activeJobs.system and finished = 1 ) as id
(select
(select max(id) from builds b
where
project = activeJobs.project and jobset = activeJobs.jobset
and job = activeJobs.job and system = activeJobs.system
and finished = 1
) as id
natural join Builds where finished = 1 group by project, jobset, job, system) as latest natural join Builds x
natural join Builds
where finished = 1
group by project, jobset, job, system)
as latest
natural join Builds x
) as latest join Builds x using (id)
) as latest
join Builds x using (id)