是这样的 表中有三列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 100 中国
2 80 中国
3 800 美国
4 900 美国
5 100 日本我要查询nation不重复,且price是最低的,结果是
id price nation
2 80 中国
3 800 美国
5 100 日本
高手赐教啊.....
where id=(select top 1 id from tb where nation=a.nation order by price)
where NOT EXISTS (
SELECT 1
FROM TB
WHERE nation=a.nation
AND price < A.price
OR price = A.price
AND ID < A.ID
)
where price=(select max(price) from tb where nation=a.nation)
where price=(select min(price) from tb where nation=a.nation)
--修改一下,price最小