Small sql-fix of joining categories and entries
Posted: Sun Mar 30, 2008 12:12 am
Hello,
I've these error messages in database logs:
ERROR: column "e.timestamp" must appear in the GROUP BY clause or be used in an aggregate function
STATEMENT: SELECT e.timestamp
FROM s9y_entries e
LEFT JOIN s9y_entrycat ec
ON e.id = ec.entryid
LEFT JOIN s9y_category c
ON ec.categoryid = c.categoryid
WHERE isdraft = 'false' AND timestamp <= 1206593700 AND ( (c.category_left BETWEEN 3 AND 4)) GROUP BY e.id
Having "GROUP BY e.id, e.timestamp" at the end should fix it (haven't found the actual place in php code yet).
I've these error messages in database logs:
ERROR: column "e.timestamp" must appear in the GROUP BY clause or be used in an aggregate function
STATEMENT: SELECT e.timestamp
FROM s9y_entries e
LEFT JOIN s9y_entrycat ec
ON e.id = ec.entryid
LEFT JOIN s9y_category c
ON ec.categoryid = c.categoryid
WHERE isdraft = 'false' AND timestamp <= 1206593700 AND ( (c.category_left BETWEEN 3 AND 4)) GROUP BY e.id
Having "GROUP BY e.id, e.timestamp" at the end should fix it (haven't found the actual place in php code yet).