单字段去重 distinct 返回其他多个字段

时间:2021-01-06 19:09:43

select a.*,
group_concat(distinct b.attribute_name)
from
sign_contract_info a
left join
sign_temp_attribute b
on
a.temp_attribute_id = b.id_
left join
sign_temp_project c
on
a.temp_project_id = c.id_
where
a.enable_=1
AND a.company_info_id = 32
group by b.attribute_name

参考

https://www.cnblogs.com/longsanshi/p/7680860.html