comparison sql/job-todo.sql @ 19:de4bf839b565

misc: revamp SQL
author David Demelier <markand@malikania.fr>
date Fri, 15 Jul 2022 11:11:48 +0200
parents 8c408176d2b1
children dd078aea5d02
comparison
equal deleted inserted replaced
18:600204c31bf0 19:de4bf839b565
19 -- 19 --
20 -- This request won't list jobs that were created before the worker itself 20 -- This request won't list jobs that were created before the worker itself
21 -- otherwise when adding a new worker it would need to run potentially a very 21 -- otherwise when adding a new worker it would need to run potentially a very
22 -- high number of jobs 22 -- high number of jobs
23 -- 23 --
24 SELECT job.id 24 SELECT `job`.`rowid`
25 , job.tag 25 , `job`.`tag`
26 , job.project_id 26 , `job`.`project_id`
27 FROM job 27 FROM `job`
28 WHERE job.id 28 WHERE `job`.`rowid`
29 NOT IN ( 29 NOT IN (
30 SELECT jobresult.job_id 30 SELECT `jobresult`.`job_id`
31 FROM jobresult 31 FROM `jobresult`
32 WHERE jobresult.worker_id = ? 32 WHERE `jobresult`.`worker_id` = ?
33 ) 33 )
34 AND job.date >= ( 34 AND `job`.`date` >= (
35 SELECT worker.date 35 SELECT `worker`.`date`
36 FROM worker 36 FROM `worker`
37 WHERE worker.id = ? 37 WHERE `worker`.`rowid` = ?
38 ) 38 )
39 LIMIT ? 39 LIMIT ?