All pastes #928916 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-05 12:19 UTC
rendered paste body
SELECT
    aa.id, aa.headline, aa.slug, aa.author_id, aa.source_id, aa.stage,
    aa.summary, aa.date, aa.image_id, aa.file, aa.site_id, aa.type_id,
    aa.path, aa.marker, aa.old_id, aa.old_wp_id
FROM
    articles_article aa
    INNER JOIN articles_articletype AS aat ON aa.type_id = aat.id
    LEFT OUTER JOIN articles_article_tags AS tags ON aa.id = tags.article_id
WHERE
    aa.stage = 'P'
    AND aa.date <= now()
    AND aat.cover = True
    AND (
        aa.site_id = 2
        OR aa.id in (
            select tags.article_id
            from articles_article_tags tags
            where tags.tag_id in (1,1,2,2,3,3)
        )
    )
ORDER BY aa.date DESC;