有2表 一个是文章artical 一个是评论,就是针对文章评论comment的
2个表中由articalID连接
现在要显示最近的10条评论,同一条文章,不能显示1条以上的评论,只显示最近的.怎么搞,想了半天,这么写行吗select top 10 * from artical as a where exsits(select * from comment as c where articalID=a.articalID) order by c.AddDate desc
2个表中由articalID连接
现在要显示最近的10条评论,同一条文章,不能显示1条以上的评论,只显示最近的.怎么搞,想了半天,这么写行吗select top 10 * from artical as a where exsits(select * from comment as c where articalID=a.articalID) order by c.AddDate desc
*
from comment a
where
not exists(
select 1 from comment where articalID=a.articalID and AddDate>a.AddDate
)
order by AddDate desc