使SQL多次选择同一行 [英] Make SQL Select same row multiple times

查看:88
本文介绍了使SQL多次选择同一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要测试我的邮件服务器.我如何做出选择语句 选择说ID = 5469一千次.

I need to test my mail server. How can I make a Select statement that selects say ID=5469 a thousand times.

推荐答案

如果我理解了您的意思,那么一种非常简单的方法是在表中包含1000行以上的表上对派生查询进行交叉联接,并在前1000个在那上面.这将使您的结果重复1000次.

If I get your meaning then a very simple way is to cross join on a derived query on a table with more than 1000 rows in it and put a top 1000 on that. This would duplicate your results 1000 times.

例如(这是MSSQL,我不知道Access是否有很大不同)

As an example (This is MSSQL, I don't know if Access is much different)

SELECT
    MyTable.*
FROM
    MyTable
CROSS JOIN
(
    SELECT TOP 1000
        *
    FROM
        sysobjects
) [BigTable]
WHERE
    MyTable.ID = 1234

这篇关于使SQL多次选择同一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆