SELECT month("publicationDate") as month,
year("publicationDate") as year,
count( "entryId" ) as entryCount
FROM "Entry"
GROUP BY year("publicationDate"),
month("publicationDate")
ORDER BY year("publicationDate") desc,
month("publicationDate") desc
SELECT e."entryId",
e."title",
e."preview",
e."publicationDate" as publicationDate,
e."publicationDate" as publicationDateTime,
e."views",
c."categoryId",
c."name" as categoryName,
u."firstName",
u."lastName",
e."disableComments",
count(DISTINCT m."commentId") as commentCount,
count(e."entryId") as temp1,
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE ( e."totalRating"/e."timesRated" )
END AS averageRating
FROM "Entry" e LEFT JOIN "EntryCategory" ec
ON e."entryId" = ec."entryId"
LEFT JOIN "Category" c
ON ec."categoryId" = c."categoryId"
JOIN "User" u
ON e."postedByUserId" = u."userId"
LEFT JOIN "Comment" m
ON e."entryId" = m."entryId"
WHERE e."publicationDate" <= getdate()
AND c."categoryId" =
AND month(e."publicationDate") =
AND year(e."publicationDate") =
AND e."publicationDate" - getDate() <=
GROUP BY e."entryId",
e."title",
e."preview",
e."publicationDate",
e."publicationDate",
e."views",
c."categoryId",
c."name",
u."firstName",
u."lastName",
e."disableComments",
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE (e."totalRating"/e."timesRated")
END
ORDER BY e."publicationDate" DESC
SELECT e."entryId",
e."title",
CASE
WHEN e."timesRated" = 0 THEN 0
ELSE (e."totalRating"/e."timesRated")
END AS averageRating
FROM "Entry" e
ORDER BY averageRating DESC
SELECT e."entryId",
e."title",
e."views"
FROM "Entry" e
ORDER BY e."views" DESC
SELECT e."entryId",
e."title",
count(c."commentId") as comments
FROM "Entry" e JOIN "Comment" c
ON e."entryId" = c."entryId"
GROUP BY e."entryId", e."title"
ORDER BY comments DESC