Skip to content

Instantly share code, notes, and snippets.

@dmacvicar
Created April 13, 2012 12:46
Show Gist options
  • Select an option

  • Save dmacvicar/2376687 to your computer and use it in GitHub Desktop.

Select an option

Save dmacvicar/2376687 to your computer and use it in GitHub Desktop.
SELECT 1,
(SELECT 1
FROM rhnServerFeaturesView SFV
WHERE SFV.server_id = S.id
AND SFV.label = 'ftr_system_grouping') AS selectable
FROM rhnServerInfo SI,
rhnServer S,
rhnActionErrataUpdate EA,
rhnServerAction SA,
rhnErrata E
WHERE S.org_id = :org_id
AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = :user_id AND USP.server_id = S.id)
AND SI.server_id = S.id
AND S.id = SA.server_id
AND SA.action_id = EA.action_id
AND EA.errata_id = E.id
AND to_timestamp(S.last_boot) < SA.completion_time
AND E.id IN (SELECT EK.errata_id FROM rhnErrataKeyword EK WHERE EK.keyword = :keyword)
AND S.id=:sid
ORDER BY SI.checkin DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment