SQL如何在AS400中选择前N个... [英] How to do SQL select top N ... in AS400
本文介绍了SQL如何在AS400中选择前N个...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何执行
Select top N * from as400table
针对as400/db2数据库的类型查询
type query against an as400/db2 database
推荐答案
Select col1,col2
from
as400table
where col1='filter'
order by col1
fetch first N row only
请记住设置一个ORDER BY
子句,因为DB2不保证FETCH FIRST N ROW ONLY
返回的行总是相同的N.
Remember to set an ORDER BY
clause, because DB2 does not guarantee that the rows returned by FETCH FIRST N ROW ONLY
are always the same N.
这篇关于SQL如何在AS400中选择前N个...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文