日韩无码专区无码一级三级片|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)銷解決方案
SQL Server數(shù)據(jù)庫(kù)分組排序后的操作

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

示例代碼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)容就是對(duì)SQL Server數(shù)據(jù)庫(kù)分組排序后取每組的第N行數(shù)據(jù)的介紹,望你能有所收獲。

【編輯推薦】

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

網(wǎng)頁(yè)題目:SQL Server數(shù)據(jù)庫(kù)分組排序后的操作
文章位置:http://www.5511xx.com/article/cdecsse.html