Get list of topics pinned globally

Aqui está uma consulta atualizada do Data Explorer que retorna uma lista mais organizada de todas as postagens fixadas por categoria, com tópicos fixados globalmente no topo:

SELECT pinned_globally, TO_CHAR(pinned_until,'DD/MM/YYYY') as pinned_till, id as topic_id, user_id, category_id 
FROM topics 
WHERE deleted_at IS NULL
AND pinned_at IS NOT NULL
AND (pinned_until IS NULL OR pinned_until > CURRENT_TIMESTAMP)
ORDER BY pinned_globally desc, category_id