在此查询中解释Max

时间:2019-01-21 20:23:37

标签: mysql sql aggregation

因此,这里的MAX用于数据透视表的用途是什么,没有它,查询将无法进行。

// We get the assembly through the base class
var baseAssembly = typeof(baseClass).GetTypeInfo().Assembly;

// we filter the defined classes according to the interfaces they implement
var typeList = baseAssembly.DefinedTypes.Where(type => type.ImplementedInterfaces.Any(inter => inter == typeof(IMyInterface))).ToList();

1 个答案:

答案 0 :(得分:0)

使用聚合函数可以减少行数,从而将单个(伪)聚合行中每个值的结果压缩为

您还可以使用min或其他聚合函数,该函数的用途仅是将多行减少为一并获得数据透视结果

SELECT
  item_id,
  MIN(IF(property_name = 'color', value, NULL)) AS color,
  MIN(IF(property_name = 'size', value, NULL)) AS size,
  MIN(IF(property_name = 'weight', value, NULL)) AS weight
FROM
  properties
GROUP BY
  item_id