pg board获取我的评论列表sql

select * from (
		select bo_id as board_id, bo_title as board_title, bo_cover_img as board_img, bo_hit as board_hit, bo_reply as board_reply, board_time, board_author, br_id as reply_id, br_content as reply_content, board_reply.created_at as reply_time, users_reply.u_nick as reply_nick, users_reply.u_idx as reply_u_id 
		from 
		board_reply 
		inner JOIN 
		(
			select *, BB.created_at as board_time, u_nick as board_author from (
				select *, 'community' as bo_type from board_community 
				UNION
				select *, 'sportNews' as bo_type from board_sport_news
			) as BB
			INNER JOIN 
			users
			on BB.bo_uid = users.u_idx
		) as AA
		ON br_bo_id = bo_id and bo_type = br_type 
		inner JOIN
		users as users_reply
		ON br_uid = users_reply.u_idx
		where users_reply.u_idx = 8 
) as CC
LEFT JOIN 
(
	select brl_br_id as like_reply_id, array_to_string(array_agg(brl_uid),',') as reply_likes from board_reply_like GROUP BY  brl_br_id 
) as LL
on like_reply_id = reply_id
LEFT JOIN 
(
	select bru_br_id as unlike_reply_id, array_to_string(array_agg(bru_uid),',') as reply_unlikes from board_reply_unlike GROUP BY  bru_br_id 
) as UL
on unlike_reply_id = reply_id
ORDER BY reply_id
offset 0 
limit 10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值