All pastes #46949 Raw Edit

Someone

public text v1 · immutable
#46949 ·published 2006-03-25 18:31 UTC
rendered paste body
SELECT post.id
     FROM list_posts AS post
     LEFT OUTER JOIN private ON (post.id = private.pid)
     LEFT OUTER JOIN official_user AS adminu ON (adminu.user = adminu.user)
     LEFT OUTER JOIN count_comments AS ccount ON (post.id = ccount.pid)
        WHERE
                   post.id = %s
                   AND(
		   adminu.user = %s            --User is the official_user  
		   OR 
           post.private = false            --Post is not private
           OR private.uid IS NOT null            --User is allowed to view post
           )
     LIMIT 1