Skip to content

Instantly share code, notes, and snippets.

@bgK bgK/14.sql Secret
Created Nov 7, 2019

Embed
What would you like to do?
SELECT *
FROM
(SELECT pr.value AS __color__,
t.id,
t.summary,
COALESCE(
(SELECT tch.author
FROM ticket_change tch
WHERE tch.ticket = t.id
AND tch.field = 'comment'
ORDER BY tch.time DESC
LIMIT 1), '(none)') "Last Comment By",
t.status,
t.type,
t.priority,
t.component,
t.time created,
t.reporter reporter,
t.changetime modified,
tc.value game
FROM ticket t
LEFT OUTER JOIN ticket_custom tc ON tc.ticket = t.id
AND tc.name = 'game'
LEFT OUTER JOIN enum pr ON pr.type = 'priority'
AND pr.name = t.priority
WHERE t.status != 'closed' ) AS sub
WHERE ("Last Comment By" = '(none)'
AND reporter <> '%s')
OR ("Last Comment By" <> '(none)'
AND "Last Comment By" <> '%s')
ORDER BY modified DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.