Order by in Inner Join

后端 未结 6 803
难免孤独
难免孤独 2021-02-18 16:28

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:34

    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.

提交回复
热议问题