join table give me incorrect result

  • natigsqlserver

    SSC-Addicted

    Points: 478

    hello i have 2 table

     select id,txt from @jo 
    select * from @temp


    id txt
    ----------- ----
    1 a
    2 f
    3 z
    4 i


    id sait sekilci
    ----------- ---- -------
    1 a in
    2 i in
    3 o un
    4 u un
    5 e in
    6 ? in
    7 i in
    8 ö ün
    9 ü ün


    and first select give me correct result


    select * from @temp where sait='i'


    id sait sekilci
    ----------- ---- -------
    7 i in

    but why this query give me incorrect result?

    select t.sekilci from @jo j inner join @temp t on j.txt=t.sait order by j.id desc


    sekilci
    -------
    in
    in
  • frederico_fonseca

    SSChampion

    Points: 14086

    if you change your query to

    select *
    from @jo j
    inner join @temp t
    on j.txt=t.sait
    order by j.id desc

    you will see why

Viewing 2 posts - 1 through 2 (of 2 total)

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