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

SQLServer分組排序取數(shù)據(jù)的實(shí)現(xiàn)

以下的文章主要向大家講述的是實(shí)現(xiàn)SQL Server分組排序之后取每組的第N行數(shù)據(jù)的實(shí)際操作步驟,我們首先是以展示代碼select 的方式來引出其實(shí)際操作步驟,以下就是文章的主要內(nèi)容描述。

目前成都創(chuàng)新互聯(lián)公司已為1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站托管、服務(wù)器托管、企業(yè)網(wǎng)站設(shè)計(jì)、突泉網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

示例代碼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分組

order by maturity asc) as rowno --按maturity排序

 

 
 
 
  1. from #tempShouhuoFenqi ) x 

 

where x.rowno=2 --取SQL Server分組排序后的第行

 

 

 
 
 
  1. ---- select * from #tempMaturity1   
  2. ---- drop table #tempMaturity1 

 

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

【編輯推薦】

  1. SQL Server數(shù)據(jù)庫管理中的10大紐帶
  2. 安裝MS SQL Server 2000失敗的緣由是什么?
  3. SQL Server索引實(shí)際結(jié)構(gòu)的理解
  4. SQL Server索引的使用誤區(qū)講述
  5. C#來對(duì)SQL Server存儲(chǔ)過程進(jìn)行創(chuàng)建

 


當(dāng)前名稱:SQLServer分組排序取數(shù)據(jù)的實(shí)現(xiàn)
當(dāng)前地址:http://uogjgqi.cn/article/djsoeeh.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

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