无重复最低价格select top 1 price
from t
group by price
having count(*)=1
order by price

解决方案 »

  1.   

    无重复最低价格 
    select top 1 price from table
    group by price 
    where count(price)=1
    order by price
      

  2.   

    select top 1 price from table
    group by price 
    where count(price)=1
    order by price
      

  3.   

    select top 1 price
    from t
    group by price
    having count(Price)=1
    order by price
      

  4.   

    group by 后面跟 where ?
      

  5.   

    select @minprice=min(price) from table
    select @maxprice=max(price) from table
    where @minprice<=@maxprice 
    begin 
      set @minprice=@minprice+0.01
      select @count=count(*) from table where price=@minprice
      if @count=0
        beign
          insert into table (price) valuse (@minprice) --要怎么插入自己看着办
        end
    end
    --记得把变量定义好
     
      

  6.   

    接受改正
    select top 1 price from table
    group by price 
    having count(price)=1
    order by price
      

  7.   

    select min(a.price)
    from (select 0.00 as price union all
          select price from t) a
    where not exists(select 1 
                     from t 
                     where price-0.01 in(select price 
                                         from (select 0.00 as price union all
                                               select price from t) a 
                     )
      

  8.   

    我日啊,数据库Price字段为字符串型,上面结果不对
      

  9.   

    不是,我觉得应该用一些类似numeric这个函数转换一下吧,学习中!
      

  10.   

    select min(a.price)-0.01
    from (select 0.00 as price union all
          select price from t) a
    where not exists(select 1 
                     from t 
                     where price-0.01 in(select price 
                                         from (select 0.00 as price union all
                                               select price from t) a 
                     ))