【发布时间】:2020-12-13 10:38:19
【问题描述】:
我有一个用于在 20,40,60 (LIMIT 20..40..60) 中运行测试的语言锻炼应用程序。 如果 LIMIT 超过所选主题中的行,如何通过重复填充结果?
table:topic Cooking 只有 18 行
假设“从表中选择 topic=Cooking order by rand() LIMIT 40
如何通过重复填充结果,使结果有 40 行,即使没有足够的行数?
table
--------------------------------------
rice
chair
spoon
knife
fork
wanted output - select * order by rand() limit 10
------------------------------------------
chair, rice, spoon, chair, knife, spoon, fork, knife, rice, fork
-------------------
// forced 10 terms
【问题讨论】:
-
请显示示例结果以及您希望额外行的外观?
标签: mysql sql random duplicates sql-order-by