自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

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

數(shù)據(jù)庫 SQL Server
此文主要向大家闡述的是SQL Server數(shù)據(jù)庫分組排序后取每組的第 N 行數(shù)據(jù)的實(shí)際操作流程,以下就是文章的主要內(nèi)容描述。

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

【編輯推薦】

  1. MS SQL Server 連接字符串的實(shí)際操作簡介
  2. SQL Server數(shù)據(jù)庫中字符串操作要用到的函數(shù)有哪些?
  3. SQL Server 連接字符串的一些聲明
  4. SQL Server 連接字符串的實(shí)現(xiàn)步驟
  5. SQL Server數(shù)據(jù)庫中可用格式字符串干什么?
責(zé)任編輯:佚名 來源: 互聯(lián)網(wǎng)
相關(guān)推薦

2010-07-09 09:24:37

SQL Server分

2011-08-22 09:55:30

SQL Server 排序

2010-07-21 10:27:49

SQL Server

2011-01-19 09:51:25

SQL Server

2010-07-01 11:14:36

SQL Server

2010-11-10 09:44:31

SQL Server端

2010-07-02 14:46:20

SQL Server數(shù)

2010-07-15 17:28:50

SQL Server

2010-07-21 10:15:43

SQL Server

2010-07-21 16:20:45

SQL Server

2010-07-21 10:05:29

SQL Server排

2010-07-01 11:03:04

SQL Server轉(zhuǎn)

2010-07-08 11:05:14

SQL Server數(shù)

2011-08-25 15:19:25

SQL Server 排序規(guī)則

2010-07-05 18:02:37

SQL Server數(shù)

2010-07-08 11:23:41

SQL Server還

2010-07-01 11:49:13

SQL Server

2010-07-22 13:59:14

MS SQL Serv

2011-04-07 13:53:04

SQL Server數(shù)

2011-03-15 09:46:20

SQL Server 數(shù)據(jù)庫崩潰
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號