SELECT top 100 name from xx1 a inner join xx2 b on a.id=b.id where b.id in (select max(id) from xx3 where type like N'%中国%' group by name)后台会连接多台数据库服务器(负载均衡) ??????。。。。。。。。。。 是不可思议吗?我也这么觉得。太奇怪了。 但如果把like 换成 charindex就不会出现结果不同的问题。这是怎么回事? 可能是排序原因造成的,排序后试试 果然是没有order by 的原因。但为何呢? SQL code: SELECT top 100 name from xx1 a inner join xx2 b on a.id=b.id where b.id in (select max(id) from xx3 where type like N'%中国%' group by name) order by name
果然是没有order by 的原因。但为何呢? 没有order by取的top 100 不是确定的 SQL code: SELECT top 100 name from xx1 a inner join xx2 b on a.id=b.id where b.id in (select max(id) from xx3 where type like N'%中国%' group by name) order by name --根據一列排序