Here is my query:
SELECT e.id, e.table_code,
( SELECT MIN(date_time) date_time,
SUM(score) score,
type,
post_id,
table_code,
comment_id,
context
FROM events
WHERE author_id = 32
GROUP BY type, post_id, table_code, comment_id, context
ORDER BY MIN(date_time) DESC
LIMIT 15 ) g
FROM events e
WHERE e.author_id = 32 AND e.date_time >= MIN(g.date_time)
ORDER BY seen ASC, date_time DESC
It throws:
#1241 - Operand should contain 1 column(s)
Any idea how can I fix it?
I'm trying to:
- Select 15 groups of latest events (the smallest id of groups)
- And then Select all events (which are belong to a specific user) that have a bigger id that that smallest id
Noted that, probably "group" be vague. Actually it's about notifications, so the notifications which has the same post id (and are related to vote) will be summed and named as one group.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…