SHARE
TWEET

Untitled

a guest Jul 17th, 2017 35 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT t1.id
  2. FROM HEAPM_Job AS t1, (
  3.     SELECT MIN(job.id) AS id
  4.     FROM HEAPM_Job AS job
  5.     LEFT JOIN HEAPM_Job AS parent_tbl ON parent_tbl.id = job.parent
  6.     WHERE
  7.       (parent_tbl.status = 'completed' OR parent_tbl.status IS NULL)
  8.     AND
  9.       job.status = 'queued'
  10.     GROUP BY job.related
  11.   ) AS t2
  12. WHERE
  13.   t1.id=t2.id
  14. ORDER BY t1.priority DESC
RAW Paste Data
Top