SELECT
"page_titles"."id",
"page_titles"."date",
"page_titles"."name",
"page_titles"."title",
SUM("page_titles"."allow") AS "allow",
SUM("page_titles"."block") AS "block",
SUM("page_titles"."hit_count") AS "hits",
"categories_category"."name" AS "category_name",
"categories_rating"."name" AS "rating_name"
FROM
"page_titles"
LEFT OUTER JOIN "categories_category" ON ("page_titles"."category_id" = "categories_category"."id")
LEFT OUTER JOIN "categories_rating" ON ("page_titles"."rating_id" = "categories_rating"."id")
GROUP BY
"page_titles"."id",
"categories_category"."name",
"categories_rating"."name"
ORDER BY
"page_titles"."date" DESC,
"page_titles"."id" DESC;
ERROR: column "page_titles.date" must appear in the GROUP BY clause or be used in an aggregate function
LINE 3: "page_titles"."date",
^
SELECT
"page_titles"."id",
"page_titles"."date",
"page_titles"."name",
SUM("page_titles"."allow") AS "allow",
SUM("page_titles"."block") AS "block",
SUM("page_titles"."hit_count") AS "hits",
"categories_category"."name" AS "category_name",
"categories_rating"."name" AS "rating_name"
FROM
"page_titles"
LEFT OUTER JOIN "categories_category" ON ("page_titles"."category_id" = "categories_category"."id")
LEFT OUTER JOIN "categories_rating" ON ("page_titles"."rating_id" = "categories_rating"."id")
GROUP BY
"page_titles"."id",
"page_titles"."date",
"page_titles"."name",
"page_titles"."title",
"categories_category"."name",
"categories_rating"."name"
ORDER BY
"page_titles"."date" DESC,
"page_titles"."id" DESC;
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/414d3e70-418c-41e9-becb-65209ed0b7eb%40googlegroups.com.
Thanks for your reply James. I wasn't able to get it to work.I posted on the new Django forum because it's easier to format code examples over there. Hopefully that clarifies things more...
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9d55c47a-c2a9-481e-82b8-d4302f4bec86%40googlegroups.com.