内联订单 [英] Order by in Inner Join
问题描述
我在查询中加入了内部联接.我得到了结果,但是不知道数据是如何输出的.谁能告诉我内部联接如何匹配数据.下面我显示一个图像.有两个表(一个或两个表).
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.Below I am showing a image.There are two table(One or Two Table).
根据我的说法,第一行应该是Mohit,但输出有所不同.请告诉我.
According to me that first row it should be Mohit but output is different.Please tell me.
谢谢.
推荐答案
如果您希望数据以某种方式返回,则必须对其进行排序.当您说希望"Mohit
"是第一行时,我假设您是因为"Mohit
"是[One]
表中的第一行.但是,当SQL Server联接表时,不一定按您认为的顺序联接.
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.
如果要返回[One]
中的第一行,请尝试按[One].[ID]
进行排序.另外,您也可以order by
任何其他列.
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.
这篇关于内联订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!