Skip to content

Instantly share code, notes, and snippets.

@illogicalextend
Created June 12, 2013 05:01
Show Gist options
  • Save illogicalextend/5762930 to your computer and use it in GitHub Desktop.
Save illogicalextend/5762930 to your computer and use it in GitHub Desktop.
SELECT DISTINCT (completion_rating + additional_rating) AS "ranking"
"users_gradaccount"."id"
"users_gradaccount"."gc_account_id"
"users_gradaccount"."name_slug"
"users_gradaccount"."password_plaintext"
"users_gradaccount"."completion_rating"
"users_gradaccount"."additional_rating"
"users_gradaccount"."old_id"
"users_gradaccount"."location_id"
"users_gradaccount"."birth_date"
"users_gradaccount"."gender"
"users_gradaccount"."have_disability"
"users_gradaccount"."visa_id"
"users_gradaccount"."personal_statement"
"users_gradaccount"."current_degree_id"
"users_gradaccount"."youtube_video_code"
"users_gradaccount"."privacy_setting"
"users_gradaccount"."share_with_friends"
"users_gradaccount"."job_alerts"
"users_gradaccount"."forum_alerts"
"users_gradaccount"."profile_alerts"
"users_gradaccount"."experienced_graduate_opportunities"
"users_gradaccount"."email_bounced"
"users_gradaccount"."email_confirmed"
"users_gradaccount"."can_email"
"users_gradaccount"."last_viewed_email"
"users_gradaccount"."receive_email_alerts"
"users_gradaccount"."receive_sms_alerts"
"users_gradaccount"."receive_push_notifications_alerts"
"users_gradaccount"."mobile_number"
"users_gradaccount"."secondary_email"
"users_gradaccount"."facebook_link"
"users_gradaccount"."twitter_link"
"users_gradaccount"."website_link"
"users_gradaccount"."linkedin_link"
"users_gcaccount"."id"
"users_gcaccount"."user_id"
"users_gcaccount"."home_site_id"
"users_gcaccount"."ip_address_at_signup"
"users_gcaccount"."ip_address_at_last_login"
"users_gcaccount"."number_of_logins"
"users_gcaccount"."email_hash"
"users_gcaccount"."email_and_password_hash"
"users_gcaccount"."banned_from_forums"
"users_gcaccount"."title"
"users_gcaccount"."avatar_url"
"auth_user"."id"
"auth_user"."password"
"auth_user"."last_login"
"auth_user"."is_superuser"
"auth_user"."username"
"auth_user"."first_name"
"auth_user"."last_name"
"auth_user"."email"
"auth_user"."is_staff"
"auth_user"."is_active"
"auth_user"."date_joined" FROM "users_gradaccount"
LEFT OUTER JOIN "users_undertakendegree" ON ("users_gradaccount"."id" = "users_undertakendegree"."grad_account_id")
LEFT OUTER JOIN "users_undertakendegree_majors" ON ("users_undertakendegree"."id" = "users_undertakendegree_majors"."undertakendegree_id")
LEFT OUTER JOIN "users_gradaccount_interested_sites" ON ("users_gradaccount"."id" = "users_gradaccount_interested_sites"."gradaccount_id")
INNER JOIN "users_gcaccount" ON ("users_gradaccount"."gc_account_id" = "users_gcaccount"."id")
INNER JOIN "auth_user" ON ("users_gcaccount"."user_id" = "auth_user"."id") WHERE (("users_undertakendegree_majors"."major_id" IN (1875) AND "users_undertakendegree"."institution_id" IN (100045)) AND (("users_gradaccount"."email_bounced" = false OR "users_gradaccount"."email_bounced" IS NULL) AND "users_gradaccount"."privacy_setting" <= 1 AND "users_gradaccount"."completion_rating" >= 0 AND "users_gradaccount_interested_sites"."gcsite_id" = 1 AND "users_gradaccount"."email_confirmed" = true AND "auth_user"."is_active" = true ) AND NOT ((UPPER("auth_user"."email"::text) LIKE UPPER(E'%gradconnection%') OR "auth_user"."is_staff" = true OR "auth_user"."is_superuser" = true ))) ORDER BY "ranking" DESC LIMIT 20;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment