我在下面有以下数据库表
我想用owner_id
1 向用户显示通知。通知显示告诉所有者两个用户(ID 为 17 和 2)用post_id
1 评论了他/她的帖子。我尝试了以下查询,但它返回 2 行。我如何构造查询以返回一行,因为我希望一起返回一篇帖子的通知?谢谢你。
SELECT DISTINCT commenters_id, id, owner_id,
post_id, type, UNIX_TIMESTAMP(date_done) AS date
FROM notification
GROUP BY commenters_id
HAVING owner_id = '$user_id' AND commenters_id != '$user_id'
ORDER BY date_done DESC