1、查询所有数据
use MengYou_SQL select * from pifa_Company where gs_passed=1 and on_top=1 and gs_bigclass=25 order by gs_add_date desc

2、查询第一条数据
use MengYou_SQL select top 1 * from pifa_Company where gs_passed=1 and on_top=1 and gs_bigclass=25 order by gs_add_date desc

3、查询第二条、第三条数据
use MengYou_SQL select top 2 * from pifa_Company where gs_passed=1 and on_top=1 and gs_bigclass=25 and gs_id not in( select top 1 gs_id from pifa_Company where on_top=1 and gs_bigclass=25 and gs_passed=1 order by gs_id desc) order by gs_add_date desc

4、实现的效果图

本文介绍了一种使用SQL进行批量数据查询的方法,包括如何查询所有数据、获取第一条数据、以及通过排除已知ID来获取特定数量的数据。这些技巧适用于需要高效处理大量数据的应用场景。

被折叠的 条评论
为什么被折叠?



