是这样的 表中有三列id   price   nation
1    100     中国
2     80     中国
3    800     美国
4    900     美国
5    100     日本我要查询nation不重复,且price是最低的,结果是
id   price   nation
2     80     中国
3    800     美国
5    100     日本
高手赐教啊.....

解决方案 »

  1.   

    select * from tb a
     where id=(select top 1 id from tb where nation=a.nation order by price)
      

  2.   

    select * from tb a
    where NOT EXISTS (
      SELECT 1
      FROM TB
      WHERE nation=a.nation
      AND price < A.price
      OR price = A.price
      AND ID < A.ID
      )
      

  3.   

    select * from tb a
     where price=(select max(price) from tb where nation=a.nation)
      

  4.   

    select * from tb a
     where price=(select min(price) from tb where nation=a.nation)
    --修改一下,price最小