高斯数据库解决多表联查分组问题
实现方式:
- **通过 group_concat( )函数 **
例如:group_concat(a.shopintroduction)
或者: substring_index(group_concat(distinct b.operatorname),’,’,1) operatorname,
最后直接group by 主表所有的参数就行。
SELECT a.starttime,group_concat(a.shopintroduction ) FROM s_online_shop_info a
left join s_online_seller s on a.sellerid = s.id
LEFT JOIN s_online_shop_credentials b ON a.id = b.shopid
LEFT JOIN s_online_shop_ticket c ON a.id = c.shopid WHERE 1 = 1
AND a.productcategory = 1 AND a.type = 1 GROUP BY (a.starttime)