#截取字符串(先正序取2个,再倒序取1个)
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('aaa-gg-cc-dd','-',2),'-',-1)

#获取子表某个字段的拼接(如:goods_name;goods_name2;goods_name3)
select o1.sn,group_concat(g1.goods_name separator ';') from orders o1
left join goods_orders g1 on g1.order_id = o1.id
where o1.created > '2018-06-13' group by o1.sn

05-12 04:41