问题:sql语句怎么一次选出5条随机且不重复的记录

sql语句怎么一次选出5条随机且不重复的记录?
在线等待
[34 byte] By [foxzz-无印凉粉] at [2008-2-13]
# 1
select top 5 * from (select distinct * from Tablename) a order by newid()
j9988-j9988 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...
# 2
agree with j9988 :)
inalover-奇遇 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...
# 3
select distinct top 5 * from table
# 4
support j9988
yinzhen-銀圳 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...
# 5
j9988的不错,select distinct top 5 * from table只能取前5条记录。

lyyrw-咋暖还寒 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...
# 6
偷偷地说我不同意,可以吗?

简单点:
select distinct top 5 * from Tablename order by newid()
# 7
to:
PFPF
不过不可以
试了么?好像不行耶
出错
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

要不用这个 :)多了一列
select distinct top 3 *,newid() from dis order by newid()
inalover-奇遇 at 2007-10-20 > top of Msdn China Tech,MS-SQL Server,基础类...