• Hello and welcome to ssc.

    Your second INNER JOIN condition references the table alias of the first. This should work, assuming suitable values in your data:

    SELECT

    u1.Name AS first,

    u2.Name AS second

    FROM Tickets t

    INNER JOIN UsersTbl u1

    ON t.Reported_by = u1.Id

    INNER JOIN UsersTbl u2

    ON t.Assign_to = u2.Id

    If it doesn't return any rows, try this to see what's happening:

    SELECT t.*, u1.*, u2.*

    FROM Tickets t

    LEFT JOIN UsersTbl u1

    ON t.Reported_by = u1.Id

    LEFT JOIN UsersTbl u2

    ON t.Assign_to = u2.Id


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]