1 select top 1 * from table 2 where something 3 order by newid()
每行增加newid(),然后排序取top 1
大数据随机时使用
SELECT * FROM Table1 WHERE (ABS(CAST( (BINARY_CHECKSUM(*) * RAND()) as int)) % 100) < 10
参考链接:https://msdn.microsoft.com/en-us/library/cc441928.aspx
时间: 2024-10-12 01:23:55