PARTITION

SELECT [TicketPlaneID]
      ,[PlaneProID]
      ,[TicketPlaneTime]
      ,[OrderID], Row_number() over(PARTITION BY TicketPlaneTime ORDER BY TicketPlaneTime  )
  FROM [TicketOrderListTable] where orderid=1039

 

今天终于用到了sql标量函数,的确很爽,省了很多代码

 

PARTITION BY :分割时间,

 

over(ORDER BY TicketPlaneTime  )按照时间进行 加序号1 2 3

 

很是使用哦!

 

你可能感兴趣的:(PARTITION)