SQL 两个结果集拼接起来的问题
- SQL code
select Sid,count(*)as Num from t_forums a group by Sidselect b.*,c.SectionName from t_forums b,t_sections cwhere b.Id=(select max(id)as Id from t_forums where Sid=c.Id)
接不起来,求高手指导指导
sid num
17
18
20
sid ... SectionName
17
18
20
[解决办法]
- SQL code
select a.*, b.*, c.SectionName from t_forums b,t_sections c,(select Sid, count(*)as Num from t_forums a group by Sid)awhere b.Id=(select max(id)as Id from t_forums where Sid=c.Id)and a.sid=b.sid