select top 5 * from
(select top 10 id,* from tA  order by id asc) page_table1 where id not in
(select id from (select top 5 * from tA order by id asc) page_table2)
同一个数据库,同样是这个语句得到的结果在本机是按id升序排列,而在客户那边却是乱的,并没有按id升序排序,请教这是为什么?数据库中有什么设置么?
说明:id为varchar类型,内容为不重复长度一致的数字字符串
      

解决方案 »

  1.   

    你的主查询中并没有排序.这样就行:
    select top 5 * from
    (select top 10 id,* from tA order by id asc) page_table1 where id not in
    (select id from (select top 5 * from tA order by id asc) page_table2)
    order by id
      

  2.   

    要 加 order by 的 
      

  3.   

    select top 5 * from
    (select top 10 * from tA order by id asc) page_table1 
    where id not in
    (select top 5 id from tA order by id asc)
      

  4.   

    加order by 我知道,这个语句是封装的框架生成的,我没法改