This article illustrates the MySQL implementation method that merges multiple data with the same ID. Share to everyone for your reference, specific as follows:
Such as:
CREATE TABLE ' c_classuser_tab ' (
' Id ' int () NOT NULL auto_increment,
' Classid ' int (one) DEFAULT null,
' Username ' varchar (MB) default null,
' studentid ' varchar (m) default null,
' College ' varchar (MB) default null ,
' Department ' varchar (MB) default null,
' Email ' varchar default NULL,
' Phone ' varchar ' default NULL, '
Status ' int (one) default null,
' Remark1 ' varchar (MB) default null,
' REMARK2 ' varchar (m) default NULL,
' REMARK3 ' varchar (MB) default null,
' activatetime ' datetime default NULL,
' Jointime ' datetime Default NULL,
' UserID ' int (one) default null,
' usertype ' int (one) default null,
PRIMARY KEY (' Id '),
Key ' C_classuser_tab_index ' (' StudentID '),
key ' Idx_classuser_complex ' (' Classid ', ' UserID ')
engine= MyISAM auto_increment=31091 DEFAULT Charset=utf8;
Teachers with the same ID have multiple substitute classes that combine them,
Teacher Substitute class
12, Class 1, Class 2.
Copy Code code as follows:
Select Username, Group_concat (Remark1, ') as classes from C_classuser_tab where userid= * and usertype=*
More information about MySQL interested readers can view the site topics: "MySQL Log operation skills Daquan", "MySQL Transaction operation skills Summary", "MySQL stored process skills encyclopedia", "MySQL database lock related skills summary" and "MySQL commonly used function large summary"
I hope this article will help you with the MySQL database meter.