sql语句查询出表里的第二条、第三条记录(附加多个条件)
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、实现的效果图