Since the fields in the two tables contain a one-to-many relationship, the group_concat function was used to splice multiple pieces of data when constructing the view to reduce the amount of data. However, after splicing, it was found that the original order had changed.
For example :
raw data:
a 1
a 2
a 3
Expected results:
a 1,2,3
actual results:
a 2,1,3 (或者其他 总之顺序改变了)
what happened?
It has to do with associated fields and extracted fields. Just sort internally group_concat(id order by id)