--合并两个关联表的字段
SELECT [GROUP_TOPICS].*,[GROUP].[Name] FROM GROUP_TOPICS INNER JOIN [GROUP] ON GROUP_TOPICS.GROUPID=[GROUP].GROUPID WHERE POSTERID=77

--相同行数据只取其中一条
SELECT  top 100 * FROM (SELECT *,ROW_NUMBER() over(partition by tid ORDER BY pid DESC) rnum FROM group_posts where PosterID=77) AS A WHERE rnum=1

 posted on 2010-04-15 16:59  ziye.cc  阅读(95)  评论(0编辑  收藏  举报