sqlserver ( Limit )

来源:互联网 发布:解放大官人杂货铺淘宝 编辑:程序博客网 时间:2024/05/16 00:48

select count(*) as n from tblcontact where email='' and officeid_fk in
--select count(*) as n from tblcontact where email='' and firstname='' and lastname='' and officeid_fk in

(
select officeid_pk from tbloffice where companyid_fk in

(
select companyid_fk from tblMCOCControl where contactnum>0 and ( RecordID_pk >= (SELECT max(RecordID_pk) AS RecordID_pk FROM tblMCOCControl WHERE contactnum>0 and RecordID_pk IN (SELECT TOP 1 RecordID_pk FROM tblMCOCControl where contactnum>0)) )AND (RecordID_pk <= (SELECT MAX(RecordID_pk) AS RecordID_pk FROM tblMCOCControl WHERE contactnum>0 and RecordID_pk IN (SELECT TOP 1000 RecordID_pk FROM tblMCOCControl where contactnum>0 ))))

)
原创粉丝点击