Order by in Inner Join

后端 未结 6 2198
离开以前
离开以前 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:14

    SQL doesn't return any ordering by default because it's faster this way. It doesn't have to go through your data first and then decide what to do.

    You need to add an order by clause, and probably order by which ever ID you expect. (There's a duplicate of names, thus I'd assume you want One.ID)

    select * From one
    inner join two
    ON one.one_name = two.one_name
    ORDER BY one.ID
    

提交回复
热议问题