我有一个包含以下字段的表:id | 域名 | domain_certificate_no | 核心价值
select 语句的输出示例如下:
'57092', '02a1fae.netsolstores.com', '02a1fae.netsolstores.com_1', '55525772666'
'57093', '02a1fae.netsolstores.com', '02a1fae.netsolstores.com_2', '22225554186'
'57094', '02a1fae.netsolstores.com', '02a1fae.netsolstores.com_3', '22444356259'
'97168', '02aa6aa.netsolstores.com', '02aa6aa.netsolstores.com_1', '55525772666'
'97169', '02aa6aa.netsolstores.com', '02aa6aa.netsolstores.com_2', '22225554186'
'97170', '02aa6aa.netsolstores.com', '02aa6aa.netsolstores.com_3', '22444356259’
我想编写一个查询来检索重复的数量keyvalue
,并且它与证书_1keyvalue
的多个相关联。domain_certificate_no
所以我写了这个:
select count(keyvalue), keyvalue from db.table group by (keyvalue)
having count(keyvalue)>1 and domain_certificate_no like '%_1';
我收到一个错误号 1054 说 unknown column domain_certificate_no
。你能告诉我有什么问题吗?如何编写查询以实现我的目的?