select * from a left join b on a.mid=b.id where a.id<>''
加入a.mid的值为(1,3)这样, 那么MYSQL是按第一个值,1去关联的。
如果需要 a.mid按第一个值排序
select * from a left join b on a.mid=b.id where a.id<>'' order by substring_index(a.mid,','1)+0
select * from a left join b on a.mid=b.id where a.id<>''
加入a.mid的值为(1,3)这样, 那么MYSQL是按第一个值,1去关联的。
如果需要 a.mid按第一个值排序
select * from a left join b on a.mid=b.id where a.id<>'' order by substring_index(a.mid,','1)+0