如何从表A中随机取出10条数据,SQL数据库

如何从表A中随机取出10条数据,SQL数据库,第1张

1.MS SQL Server,随机查询20条

select top 20  * from  表名order by newid()

2.My SQL:,随机查询20条

select  *  from  表名 order by rand() limit 20

select top 10 * from

(select * from table1

union all

select * from table2) t

order by newid()


欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/sjk/9862131.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-02
下一篇 2023-05-02

发表评论

登录后才能评论

评论列表(0条)

保存