通常,这种类型的转换最好在应用程序层完成,因为结果集不是“ SQL ish”的。也就是说,排序对于理解行很重要。
但是,您可以这样做:
select (case when row_number() over (partition by ProductCode order by (select NULL)) = 1 then ProductCode end) as ProductCode Colorfrom Productorder by ProductCode;

通常,这种类型的转换最好在应用程序层完成,因为结果集不是“ SQL ish”的。也就是说,排序对于理解行很重要。
但是,您可以这样做:
select (case when row_number() over (partition by ProductCode order by (select NULL)) = 1 then ProductCode end) as ProductCode Colorfrom Productorder by ProductCode;