Order by in Inner Join

后端 未结 6 2181
离开以前
离开以前 2021-02-18 17:05

I am putting inner join in my query.I have got the result but didn\'t know that how the data is coming in output.Can anyone tell me that how the Inner join matching the data.Bel

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-18 17:16

    You have to sort it if you want the data to come back a certain way. When you say you are expecting "Mohit" to be the first row, I am assuming you say that because "Mohit" is the first row in the [One] table. However, when SQL Server joins tables, it doesn't necessarily join in the order you think.

    If you want the first row from [One] to be returned, then try sorting by [One].[ID]. Alternatively, you can order by any other column.

提交回复
热议问题