Created
April 30, 2014 18:26
-
-
Save davenotik/57c327d008c2c771944c 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
SELECT | |
"NewsArticle"."id" AS "NewsArticle.id", | |
"NewsArticle"."title" AS "NewsArticle.title", | |
"NewsArticle"."votes" AS "NewsArticle.votes", | |
"NewsArticle"."taggedGroups" AS "NewsArticle.taggedGroups", | |
"NewsArticle"."sharedBy" AS "NewsArticle.sharedBy", | |
"NewsArticle"."numberOfComments" AS "NewsArticle.numberOfComments", | |
"NewsArticle"."url" AS "NewsArticle.url", | |
"NewsArticle"."visualGridThumbnail" AS "NewsArticle.visualGridThumbnail", | |
"NewsArticle"."visualGridThumbnailSize" AS "NewsArticle.visualGridThumbnailSize", | |
"NewsArticle"."description" AS "NewsArticle.description", | |
"NewsArticle"."unassociatedScreenName" AS "NewsArticle.unassociatedScreenName", | |
"NewsArticle"."unassociatedName" AS "NewsArticle.unassociatedName", | |
"NewsArticle"."hasActivity" AS "NewsArticle.hasActivity", | |
"NewsArticle"."lastActivityOn" AS "NewsArticle.lastActivityOn", | |
"NewsArticle"."instagramId" AS "NewsArticle.instagramId", | |
"NewsArticle"."publicationDate" AS "NewsArticle.publicationDate", | |
"NewsArticle"."createdAt" AS "NewsArticle.createdAt", | |
"NewsArticle"."sharedBy" AS "NewsArticle.sharedBy", | |
"NewsArticle"."hashtags" AS "NewsArticle.hashtags", | |
"NewsArticle"."mentions" AS "NewsArticle.mentions", | |
"NewsArticle"."images" AS "NewsArticle.images", | |
"NewsArticle"."imageThumbnails" AS "NewsArticle.imageThumbnails", | |
"NewsArticle"."videos" AS "NewsArticle.videos", | |
"NewsArticle"."score" AS "NewsArticle.score", | |
"Group"."pullTweets" AS "Group.pullTweets", | |
"Group"."title" AS "Group.title", | |
"Group"."customCss" AS "Group.customCss", | |
"Group"."follows" AS "Group.follows", | |
"Group"."code" AS "Group.code", | |
"Group"."shortDescription" AS "Group.shortDescription", | |
"Group"."logoThumbnail" AS "Group.logoThumbnail", | |
"Group"."visualGridThumbnail" AS "Group.visualGridThumbnail", | |
"Group"."sourceUrl" AS "Group.sourceUrl", | |
"Group"."visualGridThumbnailSize" AS "Group.visualGridThumbnailSize", | |
"Group"."createdAt" AS "Group.createdAt", | |
"Group"."id" AS "Group.id", | |
"Community"."id" AS "Community.id", | |
"Community"."title" AS "Community.title", | |
"Community"."code" AS "Community.code", | |
"Community"."logoThumbnail" AS "Community.logoThumbnail", | |
"Group"."title" AS "Group.title", | |
"Group"."description" AS "Group.description", | |
"Group"."visualGridThumbnail" AS "Group.visualGridThumbnail", | |
"Group"."visualGridThumbnailSize" AS "Group.visualGridThumbnailSize", | |
"Group"."createdAt" AS "Group.createdAt", | |
"Group"."id" AS "Group.id" | |
FROM | |
"NewsArticle" | |
LEFT JOIN "Group" | |
ON ("NewsArticle"."groupId" = "Group"."id") | |
LEFT JOIN "CommunityGroupLink" | |
ON "CommunityGroupLink"."communityId" IN(1552) | |
AND ("CommunityGroupLink"."groupId" = "NewsArticle"."groupId") | |
LEFT JOIN "Community" | |
ON "Community"."id" = "CommunityGroupLink"."communityId" | |
LEFT JOIN "SourceInformation" | |
ON "SourceInformation"."targetId" = "CommunityGroupLink"."communityId" | |
AND "SourceInformation"."sourceId" = "CommunityGroupLink"."groupId" | |
LEFT JOIN "SourceFilter" | |
ON "SourceFilter"."communityId" IN(1552) | |
AND "SourceFilter"."groupId" = "NewsArticle"."groupId" | |
WHERE "NewsArticle"."id" NOT IN (435701, 428123, 428139) | |
AND ("SourceInformation"."id" IS NULL | |
OR ( | |
( | |
( | |
("SourceInformation"."disabledNewsFeedIds" IS NULL | |
OR NOT ("NewsArticle"."feedId" = ANY ("SourceInformation"."disabledNewsFeedIds") | |
) | |
) AND ("SourceInformation"."disabledEventFeedIds" IS NULL | |
OR NOT ("NewsArticle"."feedId" = ANY ("SourceInformation"."disabledEventFeedIds")) | |
) | |
) | |
) AND ("SourceInformation"."disabled" = false | |
OR ("SourceInformation"."disabled" IS NULL) | |
) AND ("SourceInformation"."excludeFromMainPage" = false | |
OR ("SourceInformation"."excludeFromMainPage" IS NULL) | |
) | |
) | |
) AND ( | |
(1552 = ANY ("NewsArticle"."sharedToCommunityIds")) | |
OR ("CommunityGroupLink"."id" IS NOT NULL) | |
) AND ("SourceFilter"."id" IS NULL OR "SourceFilter"."id" = ANY("NewsArticle"."sourceFilterIds")) | |
ORDER BY "NewsArticle"."score" DESC NULLS LAST | |
LIMIT 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment