表结构如下:
CREATE TABLE c
(
id
bigint(12) NOT NULL,product_id
bigint(12) DEFAULT NULL,
fof_id
varchar(32) DEFAULT NULL ,
product_name
varchar(100) DEFAULT NULL ,
trans_code
varchar(3) NOT NULL ,
sub_trans_code
varchar(6) DEFAULT NULL ,
status
varchar(2) NOT NULL ,
PRIMARY KEY (id
) /*T![clustered_index] CLUSTERED */,
KEY idx_charge_basic_config_pcode
(product_id
,trans_code
,sub_trans_code
),
KEY idx_charge_basic_config_fof_id
(fof_id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
CREATE TABLE d
(
id
bigint(12) NOT NULL AUTO_INCREMENT ,
basic_config_id
bigint(12) NOT NULL ,
product_id
bigint(12) NOT NULL ,
trans_code
varchar(3) NOT NULL ,
sub_trans_code
varchar(6) NOT NULL,
PRIMARY KEY (id
) /*T![clustered_index] CLUSTERED */,
KEY idx_charge_synthetic_config_bci
(basic_config_id
),
KEY idx_charge_synthetic_config_pcode
(product_id
,trans_code
,sub_trans_code
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
查询sql 如下:
SELECT
*
FROM
(
SELECT
c.product_id AS productId,
c.product_name AS productName,
c.trans_code AS transCode
FROM
c
LEFT JOIN d ON c.id = d.basic_config_id
) tb1
GROUP BY
productId,
transCode
之前测试v5.0.0-rc版本没有这个问题,升级到GA版本后出现的。因为也无需要暂时不能取消‘only_full_group_by’。