av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

SQL Server數(shù)據(jù)庫分組排序后的操作

我們今天主要向大家愛描述的是SQL Server數(shù)據(jù)庫分組排序后取每組的第 N 行數(shù)據(jù)的實際操作步驟,首先我們是從select代碼示例開始的,假如你對其實際操作有興趣了解的話,你就可以通過以下的文章對其進行了解。

示例代碼select

 
 
 
  1. A.[DocNo] as [docno],   
  2. A1.[Item_ItemCode] as [itemcode],   
  3. A2.[LineNum] as [linenum],   
  4. A2.[ARBillLine] as [arbillLine],  
  5. A2.[Maturity] as [maturity],   
  6. A2.[AROCMoney_TotalMoney] as [totalmoney 

示例代碼select

 
 
 
  1. A.[DocNo] as [docno],   
  2. A1.[Item_ItemCode] as [itemcode],   
  3. A2.[LineNum] as [linenum],   
  4. A2.[ARBillLine] as [arbillLine],  
  5. A2.[Maturity] as [maturity],   
  6. A2.[AROCMoney_TotalMoney] as [totalmoney],   
  7. A2.[AROCMoneyBalance_TotalMoney] as [totalBalanceMoney]   
  8. into #tempShouhuoFenqi  
  9. from AR_ARBillHead as A   
  10. left join [AR_ARBillLine] as A1 on (A.[ID] = A1.[ARBillHead])   
  11. left join [AR_ARInstalment] as A2 on (A1.[ID] = A2.[ARBillLine])  
  12. group by A.DocNo,A1.Item_ItemCode,A2.LineNum,A2.ARBillLine,A2.Maturity,A2.AROCMoney_TotalMoney,A2.AROCMoneyBalance_TotalMoney  
  13. -- select * from #tempShouhuoFenqi  
  14. -- drop table #tempShouhuoFenqi 

合同起始日期:第期的日期

 
 
 
  1. select docno,arbillline,maturity1   
  2. into #tempMaturity1 from   
  3. (  
  4. select docno,arbillline  
  5. ,maturity as maturity1,  
  6. row_number() over   
  7. (partition by docno,arbillline --按docno,arbillline分組  
  8. order by maturity asc) as rowno --按maturity排序  
  9. from #tempShouhuoFenqi ) x  
  10. where x.rowno=2 --取分組排序后的第行   
  11. ---- select * from #tempMaturity1   
  12. ---- drop table #tempMaturity1  

以上的相關(guān)內(nèi)容就是對SQL Server數(shù)據(jù)庫分組排序后取每組的第N行數(shù)據(jù)的介紹,望你能有所收獲。

【編輯推薦】

  1. MS SQL Server 連接字符串的實際操作簡介
  2. SQL Server數(shù)據(jù)庫中字符串操作要用到的函數(shù)有哪些?
  3. SQL Server 連接字符串的一些聲明
  4. SQL Server 連接字符串的實現(xiàn)步驟
  5. SQL Server數(shù)據(jù)庫中可用格式字符串干什么?

網(wǎng)站題目:SQL Server數(shù)據(jù)庫分組排序后的操作
當前鏈接:http://uogjgqi.cn/article/cdecsse.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流