Skip to content

Instantly share code, notes, and snippets.

@Pross
Created December 29, 2010 20:56
Show Gist options
  • Save Pross/759065 to your computer and use it in GitHub Desktop.
Save Pross/759065 to your computer and use it in GitHub Desktop.
original
SELECT p.value AS __color__,
owner AS __group__,
id AS ticket, summary, t.type AS type, time AS created,
changetime AS _changetime, description AS _description,
reporter AS reporter, keywords AS _keywords
FROM ticket t
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE status <> 'closed' AND keywords not like '%buddypress' AND EXISTS(
SELECT *
FROM ticket t
WHERE id < ticket AND keywords LIKE _keywords
AND resolution = 'approved'
order by id DESC LIMIT 1
)
ORDER BY owner, CAST(p.value AS int), t.type, time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment