Created
November 21, 2008 01:19
-
-
Save vanpelt/27303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN; | |
CREATE TEMP TABLE judged AS | |
SELECT images.id AS id, images.url AS url, images.created_at AS created_at, | |
units.#{:norm_ if job.norm}bad_count / units.#{:norm_ if job.norm}judgments_count::decimal AS rating | |
FROM images LEFT OUTER JOIN units ON units.id = images.unit_id | |
WHERE (images.job_id = #{job.id} AND (images.grouped IS NOT true AND images.inappropriate)) | |
ORDER BY rating DESC, id; | |
COPY judged TO STDOUT WITH CSV HEADER; | |
ROLLBACK; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment