makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(id) id from Builds where finished = 1 $constraint group by project, jobset, job, system) natural join Builds");
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) natural join Builds");
makeSource('JobStatus' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as a natural join Builds");
makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as a natural join Builds");