We have following table, name it Products:
UserName ProductName SortOrder
--------------------------------------
U1 U1P1 2
U1 U1P2 3
U1 U1P3 5
U2 U2P1 1
U2 U2P2 2
U3 U3P1 4
UserName and ProductName can be anything. SortOrder for each UserName is incremental but can start at any index and there may be gap between them.
I need a query that sorts the data this way:
UserName ProductName SortOrder
--------------------------------------
U1 U1P1 2
U2 U2P1 1
U3 U3P1 4
U1 U1P2 3
U2 U2P2 2
U1 U1P3 5
First row for each user is added then the second row and so on.
I am not sure if this is possible to be done in Linq to Sql or not.
Also keep in mind that there may be more that 10000 rows in the table so performance is important.