select * from tablename t where 主键字段= ( select max(主键字段) from tablename where ProductID=t.ProductID and GuiGe=t.GuiGe and XingHao=t.XingHao and SalePrice=t.SalePrice )
--方法一: select distinct ProductID,GuiGe,XingHao,SalePrice into temp from tb truncate table tbinsert into( ProductID,GuiGe,XingHao,SalePrice) select ProductID,GuiGe,XingHao,SalePrice from temp
--如果仅仅是查询的话 select distinct ProductID,GuiGe,XingHao,SalePrice from tb
(
select max(主键字段) from tablename
where ProductID=t.ProductID and GuiGe=t.GuiGe and XingHao=t.XingHao and SalePrice=t.SalePrice
)
select distinct ProductID,GuiGe,XingHao,SalePrice into temp from tb truncate table tbinsert into( ProductID,GuiGe,XingHao,SalePrice)
select ProductID,GuiGe,XingHao,SalePrice
from temp
--如果仅仅是查询的话
select distinct ProductID,GuiGe,XingHao,SalePrice from tb
谢谢了,问题解决 在后面再加个 WHERE 条件就是我要的结果谢谢。