TOP 1 in an INNER JOIN query

  • Or, just use DISTINCT:

    SELECT DISTINCT

    bo.BackOfficeId,

    u.ID,

    u.UserName,

    u.Email

    FROM

    dbo.BackOffice bo INNER JOIN

    dbo.Users u ON bo.UserId = u.ID;

  • drew.allen : yes, tweaked it a bit but this works fine.

    Thank you all for your help.

  • Lynn Pettis (3/29/2012)


    Or, just use DISTINCT:

    SELECT DISTINCT

    bo.BackOfficeId,

    u.ID,

    u.UserName,

    u.Email

    FROM

    dbo.BackOffice bo INNER JOIN

    dbo.Users u ON bo.UserId = u.ID;

    i think that distinct is the correct choice here. every thing else adds to the execution time (all caveats of generality apply). its the first place i would have gone.

    EDIT : quoted wrong post - fixed


    For faster help in answering any problems Please read How to post data/code on a forum to get the best help - Jeff Moden[/url] for the best way to ask your question.

    For performance Issues see how we like them posted here: How to Post Performance Problems - Gail Shaw[/url]

    Need to Split some strings? Jeff Moden's DelimitedSplit8K[/url]
    Jeff Moden's Cross tab and Pivots Part 1[/url]
    Jeff Moden's Cross tab and Pivots Part 2[/url]

Viewing 3 posts - 16 through 17 (of 17 total)

You must be logged in to reply to this topic. Login to reply