如何从PHP中的SQL Server获取20到20条记录

时间:2022-06-02 22:15:17
select 
   TOP 20 * 
from 
  (select 
     TOP 30 *
   from SavingRecurringMst_Kuber r, BhishiRegistrationMst b,  
        SavingRegistrationMst_Kuber s 
   where 
       RegID = FKRegID and 
       PkSavingRegID = FKSavinRegID ) as T 
ORDER BY 
   Transactionate DESC

1 个解决方案

#1


1  

Try this...! Pass the start index and end index as parameter from UI.

试试这个...!将起始索引和结束索引作为参数从UI传递。

select SLNO, T.*
from  (
         select 
          ROW_NUMBER() OVER (ORDER BY Transactionate DESC) AS SLNO , SavingRecurringMst_Kuber.*
       from SavingRecurringMst_Kuber r, BhishiRegistrationMst b,  
            SavingRegistrationMst_Kuber s 
       where 
           RegID = FKRegID and 
           PkSavingRegID = FKSavinRegID    
       ) as T 
 where T.SLNO >= P_STARTINDEX and T.SLNO <= P_ENDINDEX 

#1


1  

Try this...! Pass the start index and end index as parameter from UI.

试试这个...!将起始索引和结束索引作为参数从UI传递。

select SLNO, T.*
from  (
         select 
          ROW_NUMBER() OVER (ORDER BY Transactionate DESC) AS SLNO , SavingRecurringMst_Kuber.*
       from SavingRecurringMst_Kuber r, BhishiRegistrationMst b,  
            SavingRegistrationMst_Kuber s 
       where 
           RegID = FKRegID and 
           PkSavingRegID = FKSavinRegID    
       ) as T 
 where T.SLNO >= P_STARTINDEX and T.SLNO <= P_ENDINDEX