FWQ
MySQL 关联查询分组目的:为什么使用 `p2.product_type = p1.product_type` 进行分组?
MySQL 关联查询不解:p2.product_type = p1.product_type 分组目的 在 MySQL 关联查询中,使用 FROM 子句后指定的表别名是用来区分不同表的,它们可以随意指定。这里,p2 是 product 表的别名,可以将其理解为对 product 表的重命名。 至于 p2.product_type = p1.product_type 条件,这是在执行查询时的过滤条件,只匹配满足该条件的行。该条件要求 p2 表中 product_type 列必须与 p1 表中 product_type 列相等。…