如何在一个字段上使用Distinct
或Group by
声明,或者使用SELECT
声明全部或至少几个?Group by或Distinct - 但有几个字段
示例:使用SQL SERVER!
SELECT id_product,
description_fr,
DiffMAtrice,
id_mark,
id_type,
NbDiffMatrice,
nom_fr,
nouveaute
From C_Product_Tempo
我想Distinct
或Group By nom_fr
刚刚得到解答: 选择id_product,description_fr,DiffMAtrice,id_mark,ID_TYPE,NbDiffMatrice,nom_fr,从nouveaute ( SELECT RN = ROW_NUMBER()超过(由[nom_fr]通过id_mark顺序分区) ,id_product,description_fr,DiffMAtrice,id_mark,ID_TYPE,NbDiffMatrice,nom_fr,nouveaute 从C_Product_Tempo )d 其中RN = 1
而且这个工作非常完美!
你能提供几行数据,你想在最终结果中达到什么目的? – HKImpact