SQL 分组统计并返回当前行
/*分组统计时只能返回统计后的结果、比如要获得统计组最新插入的总条记录就不是很好办了、下面这条SQL语句希望可能帮到大家、*/
select * from MusicGood T1 left join (select count(*) as counts,max(addDate) as addDate from MusicGood group by MusicListID) T2 on T1.addDate = T2.addDate where counts is not null
posted on 2010-09-02 00:39 Billt_chen 阅读(363) 评论(0) 编辑 收藏 举报