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后的两段结果顺序就不一样?比较奇怪