我有一个名为attproduct:
有三列id, attribute, values。
我有color和列brand中的每个id和列attribute中的相应值value
SELECT id, MAX( IF( attribute = 'brand', value, NULL ) ) AS Brand,
MAX( IF( attribute = 'color', value, NULL ) ) AS color
FROM fy.attproduct
GROUP BY id
当我运行此查询时,我会在id, brand, color列中获得所需的输出。
我需要知道 max 在我的查询中的作用是什么,当我删除 max 时,我得到空值