Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
(select top 1 percent A from B order by newid())
我想从表 B 中获取随机记录
像这样使用...
select * from B where A in (select top 1 percent A from B order by newid())
或者
select top 1 percent A from B order by newid()
两者都会每次都给你随机的行......
编辑 :
从大表中随机选择行