Home  >  Article  >  Database  >  数据库-我写了一段mysql查询,但是两段order by的顺序却不一样,求助

数据库-我写了一段mysql查询,但是两段order by的顺序却不一样,求助

WBOY
WBOYOriginal
2016-06-06 09:39:501137browse

mysql数据库

第一段是不分页的

<code>select T.ID ,TName.Name  ,(select Count(UsingT.TID) from UsingT where UsingT.TID=T.ID) as LinkCountfrom T inner join TName on T.TNameID = TName.ID and TName.Name like @tname order by Name asc;          </code>

第二段是分页的

<code>select T.ID ,TName.Name ,(select Count(UsingT.TID) from UsingT where UsingT.TID=T.ID) as LinkCountfrom T inner join TName on T.TNameID = TName.ID where T.ID in (select ID from (select T.ID from T inner join TName on T.TNameID=TName.ID and TName.Name like @Tname order by Name asc        </code>

但是order by后的两段结果顺序就不一样?比较奇怪

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn