• If I understand correctly, you simply want it where all teams play all the other teams? Here's one way to do that...

    --===== Declare and set the number of players present.

    -- This could be a parameter in a stored procedure or function.

    DECLARE @NumberOfPlayers INT;

    SELECT @NumberOfPlayers = 7; --Obviously, there will be a "BYE" for the 8th position.

    --===== If the number of players is an odd number, add 1 to the number of players

    SELECT @NumberOfPlayers = @NumberOfPlayers + (@NumberOfPlayers %2);

    --===== Create the "Round Robin" schedule using a Triangular Join (a limited form of CROSS JOIN).

    -- A better way to do this would be to use a Tally Table instead of master.dbo.spt_values.

    -- Please see the following article for that.

    -- http://www.sqlservercentral.com/articles/T-SQL/62867/

    WITH

    cteTally AS

    (

    SELECT PlayerNumber = Number

    FROM master.dbo.spt_values

    WHERE Type = 'P'

    AND Number BETWEEN 1 AND @NumberOfPlayers

    )

    SELECT t1.PlayerNumber, t2.PlayerNumber

    FROM cteTally t1

    INNER JOIN cteTally t2

    ON t1.PlayerNumber < t2.PlayerNumber

    ;

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)