Small sql-fix of joining categories and entries

Found a bug? Tell us!!
Post Reply
jemm4jemm
Regular
Posts: 15
Joined: Thu Apr 19, 2007 2:54 pm

Small sql-fix of joining categories and entries

Post by jemm4jemm »

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).
Post Reply