试试这个:
--drop table tcreate table t(product_price numeric(10,1))insert into t
select -1.0 as product_price union all
select 0.0  union all
select 1.0  union all
select 2.0 
go
select t.*
from t
inner join
(
select max(product_price) max_price from t
)tt
 on 1=1
order by case when t.product_price = -1 then tt.max_price+1 else t.product_price end
/*
product_price
0.0
1.0
2.0
-1.0
*/

解决方案 »

  1.   

    上面的代码求表中最大的product_price ,然后加1,所以这个-1 就是最大的了,再order by就可以
      

  2.   

    select row_number() over
     (order by case when Product_Price<0 then 2 else 1 end,Product_Price)m,* from 表试试这个肯定可以的
      

  3.   


    --再简化下,
      select * from 表 order by case when Product_Price<0 then 2 else 1 end,Product_Price
      

  4.   

    数值型直接order by也可以的啊
    CREATE TABLE testorder
    (a FLOAT)
    INSERT INTO testorder
    SELECT 1.0
    UNION ALL 
    SELECT -1
    UNION ALL 
    SELECT 0SELECT * FROM testorder ORDER BY a desc/*
    a
    ----------------------
    1
    0
    -1
    */
    不过和排序规则也会有点关系
      

  5.   


    SELECT *
    FROM   表
    ORDER  BY Sign(Product_Price + 1) DESC,
              Product_Price ASC 
      

  6.   

    楼主试试这个select * from testorder where a<>-1
    union all
    select * from testorder where a=-1