Declare @temp as Table ( ID INT PRIMARY KEY IDENTITY(1, 1),

0

Please login or register to vote for this query.

(click on this box to dismiss)

Audio-Video Production Meta

Q&A for engineers, producers, editors, and enthusiasts spanning the fields of audio, video, and media creation

Declare @temp as Table
(
	ID INT PRIMARY KEY IDENTITY(1, 1),
	Direction Varchar(1),
	Bay INT
)

INSERT INTO @temp
values ('L', 1), ('R', 1), ('R', 2), ('L', 2), ('L', 3), ('R', 3), ('L', 4), ('R', 4)

Select *, 
Row_Number() OVER (PARTITION BY Direction ORDER BY Bay ASC) AS RowNumber,
Rank() OVER (PARTITION BY Direction ORDER BY Bay ASC) AS Rank_Part,
Rank() OVER (ORDER BY Bay ASC) AS Rank,
DENSE_Rank() OVER (ORDER BY Bay ASC) AS DENSERank
from @temp order by ID

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results