日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
SQLServer分組排序取數(shù)據(jù)的實(shí)現(xiàn)

以下的文章主要向大家講述的是實(shí)現(xiàn)SQL Server分組排序之后取每組的第N行數(shù)據(jù)的實(shí)際操作步驟,我們首先是以展示代碼select 的方式來(lái)引出其實(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ù)庫(kù)管理中的10大紐帶
  2. 安裝MS SQL Server 2000失敗的緣由是什么?
  3. SQL Server索引實(shí)際結(jié)構(gòu)的理解
  4. SQL Server索引的使用誤區(qū)講述
  5. C#來(lái)對(duì)SQL Server存儲(chǔ)過程進(jìn)行創(chuàng)建

 


分享文章:SQLServer分組排序取數(shù)據(jù)的實(shí)現(xiàn)
標(biāo)題來(lái)源:http://m.5511xx.com/article/djsoeeh.html