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

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

WBOY
Release: 2016-06-06 09:39:50
Original
1199 people have browsed it

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>
Copy after login

第二段是分页的

<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>
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template